Search in sources :

Example 11 with QueryRequestImpl

use of ddf.catalog.operation.impl.QueryRequestImpl 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));
}
Also used : ProcessingDetails(ddf.catalog.operation.ProcessingDetails) SourceUnavailableException(ddf.catalog.source.SourceUnavailableException) QueryResponseImpl(ddf.catalog.operation.impl.QueryResponseImpl) QueryImpl(ddf.catalog.operation.impl.QueryImpl) QueryResponse(ddf.catalog.operation.QueryResponse) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) UnsupportedQueryException(ddf.catalog.source.UnsupportedQueryException) FederationException(ddf.catalog.federation.FederationException) ProcessingDetailsImpl(ddf.catalog.operation.impl.ProcessingDetailsImpl) SourceUnavailableException(ddf.catalog.source.SourceUnavailableException) UnsupportedQueryException(ddf.catalog.source.UnsupportedQueryException) FederationException(ddf.catalog.federation.FederationException) Test(org.junit.Test)

Example 12 with QueryRequestImpl

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

Example 13 with QueryRequestImpl

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

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

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

Aggregations

QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)216 QueryImpl (ddf.catalog.operation.impl.QueryImpl)187 Test (org.junit.Test)142 Filter (org.opengis.filter.Filter)103 SourceResponse (ddf.catalog.operation.SourceResponse)100 QueryRequest (ddf.catalog.operation.QueryRequest)86 Metacard (ddf.catalog.data.Metacard)72 Result (ddf.catalog.data.Result)60 QueryResponse (ddf.catalog.operation.QueryResponse)46 ArrayList (java.util.ArrayList)46 UnsupportedQueryException (ddf.catalog.source.UnsupportedQueryException)32 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)29 Query (ddf.catalog.operation.Query)28 HashMap (java.util.HashMap)28 FederationException (ddf.catalog.federation.FederationException)27 Serializable (java.io.Serializable)27 Matchers.containsString (org.hamcrest.Matchers.containsString)22 Matchers.anyString (org.mockito.Matchers.anyString)20 SortByImpl (ddf.catalog.filter.impl.SortByImpl)19 SourceUnavailableException (ddf.catalog.source.SourceUnavailableException)18