Search in sources :

Example 16 with QueryImpl

use of ddf.catalog.operation.impl.QueryImpl 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 17 with QueryImpl

use of ddf.catalog.operation.impl.QueryImpl 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 18 with QueryImpl

use of ddf.catalog.operation.impl.QueryImpl 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 19 with QueryImpl

use of ddf.catalog.operation.impl.QueryImpl 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)

Example 20 with QueryImpl

use of ddf.catalog.operation.impl.QueryImpl in project ddf by codice.

the class CommonQueryBuilder method intersects.

public QueryImpl intersects(Geometry geometry) {
    QueryImpl query = new QueryImpl(filterFactory.intersects(Metacard.ANY_GEO, geometry));
    query.setStartIndex(1);
    query.setRequestsTotalResultsCount(true);
    return query;
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl)

Aggregations

QueryImpl (ddf.catalog.operation.impl.QueryImpl)232 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)186 Test (org.junit.Test)149 Filter (org.opengis.filter.Filter)117 SourceResponse (ddf.catalog.operation.SourceResponse)95 QueryRequest (ddf.catalog.operation.QueryRequest)66 Metacard (ddf.catalog.data.Metacard)61 ArrayList (java.util.ArrayList)50 Result (ddf.catalog.data.Result)49 Matchers.containsString (org.hamcrest.Matchers.containsString)30 Query (ddf.catalog.operation.Query)29 QueryResponse (ddf.catalog.operation.QueryResponse)28 SortByImpl (ddf.catalog.filter.impl.SortByImpl)27 UnsupportedQueryException (ddf.catalog.source.UnsupportedQueryException)25 SortBy (org.opengis.filter.sort.SortBy)25 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)24 Serializable (java.io.Serializable)23 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)22 HashMap (java.util.HashMap)20 Matchers.anyString (org.mockito.Matchers.anyString)20