use of ddf.catalog.operation.impl.QueryImpl in project ddf by codice.
the class CqlResultTest method distanceCheck.
private void distanceCheck(Double input, Double output) {
MetacardImpl metacard = new MetacardImpl(BasicTypes.BASIC_METACARD);
ResultImpl result = new ResultImpl(metacard);
result.setDistanceInMeters(input);
ActionRegistry actionRegistry = mock(ActionRegistry.class);
when(actionRegistry.list(any())).thenReturn(Collections.emptyList());
QueryRequest request = new QueryRequestImpl(new QueryImpl(filterBuilder.attribute("test").equalTo().text("value")));
CqlResult cqlResult = new CqlResult(result, null, request, false, filterAdapter, actionRegistry);
assertThat(cqlResult.getDistance(), is(output));
}
use of ddf.catalog.operation.impl.QueryImpl in project ddf by codice.
the class MetacardsMigratable method export.
/**
* Exports all the metacards currently stored in the catalog framework.
* <p>
* {@inheritDoc}
*/
@Override
@NotNull
public MigrationMetadata export(@NotNull Path exportPath) throws MigrationException {
config.setExportPath(exportPath.resolve(this.getId()));
fileWriter.createExportDirectory(config.getExportPath());
Collection<MigrationWarning> warnings = new ArrayList<>();
Map<String, Serializable> props = createMapWithNativeQueryMode();
Filter dumpFilter = filterBuilder.attribute(Metacard.ANY_TEXT).is().like().text("*");
QueryImpl exportQuery = new QueryImpl(dumpFilter);
exportQuery.setPageSize(config.getExportQueryPageSize());
exportQuery.setRequestsTotalResultsCount(false);
QueryRequest exportQueryRequest = new QueryRequestImpl(exportQuery, props);
try {
executeQueryLoop(exportQuery, exportQueryRequest);
} catch (Exception e) {
LOGGER.info("Internal error occurred when exporting catalog: {}", e);
throw new ExportMigrationException(DEFAULT_FAILURE_MESSAGE);
} finally {
cleanup();
}
return new MigrationMetadata(warnings);
}
use of ddf.catalog.operation.impl.QueryImpl in project ddf by codice.
the class CatalogMetricsTest method catalogExceptionMetric.
@Test
public void catalogExceptionMetric() throws Exception {
QueryResponse response = new QueryResponseImpl(new QueryRequestImpl(new QueryImpl(idFilter)));
Set<ProcessingDetails> details = response.getProcessingDetails();
details.addAll(new HashSet<ProcessingDetails>() {
{
add(new ProcessingDetailsImpl("source1", new UnsupportedQueryException()));
add(new ProcessingDetailsImpl("source2", new SourceUnavailableException()));
add(new ProcessingDetailsImpl("source3", new FederationException()));
add(new ProcessingDetailsImpl("source4", new Exception()));
}
});
underTest.process(response);
assertThat(underTest.exceptions.getCount(), is(4L));
assertThat(underTest.unsupportedQueryExceptions.getCount(), is(1L));
assertThat(underTest.sourceUnavailableExceptions.getCount(), is(1L));
assertThat(underTest.federationExceptions.getCount(), is(1L));
}
use of ddf.catalog.operation.impl.QueryImpl in project ddf by codice.
the class CatalogMetricsTest method catalogTemporalQueryMetric.
@Test
public void catalogTemporalQueryMetric() throws Exception {
Filter temporalFilter = filterBuilder.attribute(Metacard.ANY_DATE).before().date(new Date());
QueryRequest query = new QueryRequestImpl(new QueryImpl(temporalFilter));
underTest.process(query);
assertThat(underTest.temporalQueries.getCount(), is(1L));
}
use of ddf.catalog.operation.impl.QueryImpl in project ddf by codice.
the class CatalogMetricsTest method catalogQueryMetric.
@Test
public void catalogQueryMetric() throws Exception {
QueryRequest query = new QueryRequestImpl(new QueryImpl(idFilter));
underTest.process(query);
assertThat(underTest.queries.getCount(), is(1L));
assertThat(underTest.comparisonQueries.getCount(), is(1L));
}
Aggregations