use of ddf.catalog.operation.SourceResponse in project ddf by codice.
the class SolrCache method query.
@Override
public List<Metacard> query(Filter filter) throws UnsupportedQueryException {
QueryRequest queryRequest = new QueryRequestImpl(new QueryImpl(filter), true);
SourceResponse response = solrClientAdaptor.getSolrMetacardClient().query(queryRequest);
return getMetacardsFromResponse(response);
}
use of ddf.catalog.operation.SourceResponse in project ddf by codice.
the class TestGeoJsonQueryResponseTransformer method testNullMetacard.
@Test(expected = CatalogTransformerException.class)
public void testNullMetacard() throws CatalogTransformerException {
List<Result> results = new LinkedList<Result>();
Result result = new ResultImpl(null);
results.add(result);
SourceResponse sourceResponse = new SourceResponseImpl(null, results, 1L);
new GeoJsonQueryResponseTransformer().transform(sourceResponse, null);
}
use of ddf.catalog.operation.SourceResponse in project ddf by codice.
the class TestGeoJsonQueryResponseTransformer method testGoodResponse.
@Test
public void testGoodResponse() throws CatalogTransformerException, IOException, ParseException {
final int resultCount = 3;
final int hitCount = 12;
SourceResponse sourceResponse = setupResponse(resultCount, hitCount);
JSONObject obj = transform(sourceResponse, resultCount, hitCount);
verifyResponse(obj, resultCount, hitCount);
}
use of ddf.catalog.operation.SourceResponse in project ddf by codice.
the class TestGeoJsonQueryResponseTransformer method testNullResult.
@Test(expected = CatalogTransformerException.class)
public void testNullResult() throws CatalogTransformerException {
List<Result> results = new LinkedList<Result>();
results.add(null);
results.add(null);
SourceResponse sourceResponse = new SourceResponseImpl(null, results, 2L);
new GeoJsonQueryResponseTransformer().transform(sourceResponse, null);
}
use of ddf.catalog.operation.SourceResponse in project ddf by codice.
the class DuplicationValidator method query.
private SourceResponse query(Set<Attribute> attributes, String originalId) {
final Filter filter = filterBuilder.allOf(filterBuilder.anyOf(buildFilters(attributes)), filterBuilder.not(filterBuilder.attribute(Metacard.ID).is().equalTo().text(originalId)));
LOGGER.debug("filter {}", filter);
QueryImpl query = new QueryImpl(filter);
query.setRequestsTotalResultsCount(false);
QueryRequest request = new QueryRequestImpl(query);
SourceResponse response = null;
try {
response = catalogFramework.query(request);
} catch (FederationException | SourceUnavailableException | UnsupportedQueryException e) {
LOGGER.debug("Query failed ", e);
}
return response;
}
Aggregations