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));
}
use of ddf.catalog.operation.QueryRequest in project ddf by codice.
the class CatalogMetricsTest method catalogFuzzyQueryMetric.
@Test
public void catalogFuzzyQueryMetric() throws Exception {
Filter fuzzyFilter = filterBuilder.attribute(Metacard.ANY_TEXT).like().fuzzyText("fuzzy");
QueryRequest query = new QueryRequestImpl(new QueryImpl(fuzzyFilter));
underTest.process(query);
assertThat(underTest.fuzzyQueries.getCount(), is(1L));
}
use of ddf.catalog.operation.QueryRequest in project ddf by codice.
the class CatalogMetricsTest method catalogResultCountMetric.
@Test
public void catalogResultCountMetric() throws Exception {
QueryRequest query = new QueryRequestImpl(new QueryImpl(idFilter));
QueryResponse response = new QueryResponseImpl(query, new ArrayList(), 50);
underTest.process(response);
assertThat(underTest.resultCount.getCount(), is(1L));
assertThat(underTest.resultCount.getSnapshot().getMean(), is(50.0));
}
use of ddf.catalog.operation.QueryRequest in project ddf by codice.
the class CatalogMetricsTest method catalogFederatedQueryMetricForLocalQueries.
@Test
public void catalogFederatedQueryMetricForLocalQueries() throws Exception {
QueryRequest query = new QueryRequestImpl(new QueryImpl(idFilter), Arrays.asList(""));
underTest.process(query);
query = new QueryRequestImpl(new QueryImpl(idFilter), Arrays.asList((String) null));
underTest.process(query);
System.setProperty(SystemInfo.SITE_NAME, "localSourceId");
query = new QueryRequestImpl(new QueryImpl(idFilter), Arrays.asList("localSourceId"));
underTest.process(query);
assertThat(underTest.federatedQueries.getCount(), is(0L));
}
Aggregations