Search in sources :

Example 16 with QueryRequest

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));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) QueryRequest(ddf.catalog.operation.QueryRequest) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) Test(org.junit.Test)

Example 17 with QueryRequest

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));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) QueryRequest(ddf.catalog.operation.QueryRequest) Filter(org.opengis.filter.Filter) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) Test(org.junit.Test)

Example 18 with QueryRequest

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));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) QueryRequest(ddf.catalog.operation.QueryRequest) Filter(org.opengis.filter.Filter) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) Test(org.junit.Test)

Example 19 with QueryRequest

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));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) QueryResponseImpl(ddf.catalog.operation.impl.QueryResponseImpl) QueryRequest(ddf.catalog.operation.QueryRequest) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) QueryResponse(ddf.catalog.operation.QueryResponse) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 20 with QueryRequest

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));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) QueryRequest(ddf.catalog.operation.QueryRequest) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) Test(org.junit.Test)

Aggregations

QueryRequest (ddf.catalog.operation.QueryRequest)153 Test (org.junit.Test)98 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)86 QueryImpl (ddf.catalog.operation.impl.QueryImpl)66 QueryResponse (ddf.catalog.operation.QueryResponse)57 ArrayList (java.util.ArrayList)41 SourceResponse (ddf.catalog.operation.SourceResponse)39 Metacard (ddf.catalog.data.Metacard)33 Result (ddf.catalog.data.Result)31 Filter (org.opengis.filter.Filter)31 UnsupportedQueryException (ddf.catalog.source.UnsupportedQueryException)30 Query (ddf.catalog.operation.Query)29 Source (ddf.catalog.source.Source)24 FederationException (ddf.catalog.federation.FederationException)20 QueryResponseImpl (ddf.catalog.operation.impl.QueryResponseImpl)15 InputStream (java.io.InputStream)15 SourceUnavailableException (ddf.catalog.source.SourceUnavailableException)14 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)13 SortByImpl (ddf.catalog.filter.impl.SortByImpl)11 HashMap (java.util.HashMap)11