Search in sources :

Example 96 with QueryRequest

use of ddf.catalog.operation.QueryRequest in project ddf by codice.

the class NoOpSolrMetacardClientTest method queryWithRequest.

@Test
public void queryWithRequest() throws Exception {
    QueryRequest mockRequest = mock(QueryRequest.class);
    SourceResponse response = noOpSolrMetacardClient.query(mockRequest);
    assertThat(response.getRequest(), is(mockRequest));
    assertThat(response.getResults(), is(empty()));
    assertThat(response.getHits(), is(equalTo(0L)));
}
Also used : QueryRequest(ddf.catalog.operation.QueryRequest) SourceResponse(ddf.catalog.operation.SourceResponse) Test(org.junit.Test)

Example 97 with QueryRequest

use of ddf.catalog.operation.QueryRequest in project ddf by codice.

the class ValidationQueryFactoryTest method testSearchValid.

@Test
public void testSearchValid() throws StopProcessingException, PluginExecutionException, UnsupportedQueryException {
    QueryImpl query = new QueryImpl(filterBuilder.attribute(Validation.VALIDATION_WARNINGS).is().empty());
    ValidationQueryDelegate delegate = new ValidationQueryDelegate();
    assertThat(filterAdapter.adapt(query, delegate), is(true));
    QueryRequest returnQuery = validationQueryFactory.getQueryRequestWithValidationFilter(new QueryRequestImpl(query));
    assertThat(filterAdapter.adapt(returnQuery.getQuery(), delegate), is(true));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) QueryRequest(ddf.catalog.operation.QueryRequest) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) ValidationQueryDelegate(ddf.catalog.filter.delegate.ValidationQueryDelegate) Test(org.junit.Test)

Example 98 with QueryRequest

use of ddf.catalog.operation.QueryRequest in project ddf by codice.

the class ValidationQueryFactoryTest method testSearchBothImplicit.

@Test
public void testSearchBothImplicit() throws StopProcessingException, PluginExecutionException, UnsupportedQueryException {
    QueryImpl query = new QueryImpl(filterBuilder.allOf(filterBuilder.attribute(Validation.VALIDATION_WARNINGS).is().empty(), filterBuilder.attribute(Validation.VALIDATION_WARNINGS).is().equalTo().text("*")));
    QueryRequest returnQuery = validationQueryFactory.getQueryRequestWithValidationFilter(new QueryRequestImpl(query));
    assertThat(filterAdapter.adapt(returnQuery.getQuery(), testValidationQueryDelegate), is(true));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) QueryRequest(ddf.catalog.operation.QueryRequest) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) Test(org.junit.Test)

Example 99 with QueryRequest

use of ddf.catalog.operation.QueryRequest in project ddf by codice.

the class ValidationQueryFactoryTest method testSearchBoth.

@Test
public void testSearchBoth() throws StopProcessingException, PluginExecutionException, UnsupportedQueryException {
    QueryImpl query = new QueryImpl(filterBuilder.allOf(filterBuilder.attribute(Validation.VALIDATION_WARNINGS).is().empty(), filterBuilder.attribute(Validation.VALIDATION_WARNINGS).is().equalTo().text("sample")));
    QueryRequest returnQuery = validationQueryFactory.getQueryRequestWithValidationFilter(new QueryRequestImpl(query));
    assertThat(filterAdapter.adapt(returnQuery.getQuery(), testValidationQueryDelegate), is(true));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) QueryRequest(ddf.catalog.operation.QueryRequest) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) Test(org.junit.Test)

Example 100 with QueryRequest

use of ddf.catalog.operation.QueryRequest in project ddf by codice.

the class ValidationQueryFactoryTest method testSearchInvalid.

@Test
public void testSearchInvalid() throws StopProcessingException, PluginExecutionException, UnsupportedQueryException {
    QueryImpl query = new QueryImpl(filterBuilder.attribute(Validation.VALIDATION_WARNINGS).is().equalTo().text("sample"));
    ValidationQueryDelegate delegate = new ValidationQueryDelegate();
    assertThat(filterAdapter.adapt(query, testValidationQueryDelegate), is(true));
    QueryRequest returnQuery = validationQueryFactory.getQueryRequestWithValidationFilter(new QueryRequestImpl(query));
    assertThat(filterAdapter.adapt(returnQuery.getQuery(), testValidationQueryDelegate), is(true));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) QueryRequest(ddf.catalog.operation.QueryRequest) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) ValidationQueryDelegate(ddf.catalog.filter.delegate.ValidationQueryDelegate) 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