use of ddf.catalog.operation.QueryRequest in project ddf by codice.
the class CqlRequestTest method testCreateQueryWithCacheSource.
@Test
public void testCreateQueryWithCacheSource() {
cqlRequest.setSort(SORT_PROPERTY + DESC_SORT_ORDER);
cqlRequest.setSrc(CACHE_SOURCE);
QueryRequest queryRequest = cqlRequest.createQueryRequest(CACHE_SOURCE, filterBuilder);
SortBy sortBy = queryRequest.getQuery().getSortBy();
assertThat(sortBy.getPropertyName().getPropertyName(), is(SORT_PROPERTY));
assertThat(sortBy.getSortOrder(), is(SortOrder.DESCENDING));
assertThat(queryRequest.getPropertyValue(MODE), is(CACHE_SOURCE));
}
use of ddf.catalog.operation.QueryRequest 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.QueryRequest 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.QueryRequest 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));
}
use of ddf.catalog.operation.QueryRequest in project ddf by codice.
the class CatalogMetricsTest method catalogSpatialQueryMetric.
@Test
public void catalogSpatialQueryMetric() throws Exception {
Filter geoFilter = filterBuilder.attribute(Metacard.ANY_GEO).within().wkt("POLYGON ((1 1,2 1,2 2,1 2,1 1))");
QueryRequest query = new QueryRequestImpl(new QueryImpl(geoFilter));
underTest.process(query);
assertThat(underTest.spatialQueries.getCount(), is(1L));
}
Aggregations