Search in sources :

Example 6 with Query

use of org.codice.alliance.nsili.common.GIAS.Query in project alliance by codice.

the class SubmitStandingQueryRequestImplTest method setupStandingQueryRequest.

private void setupStandingQueryRequest() throws InvalidInputParameter, SystemFault, ProcessingFault, WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive {
    Query query = getQuery();
    String[] resultAttributes = new String[0];
    SortAttribute[] sortAttributes = new SortAttribute[0];
    QueryLifeSpan lifespan = getEmptyLifespan();
    NameValue[] properties = new NameValue[0];
    // Set artificially low for for test cases.
    long defaultUpdateFrequencyMsec = 2000;
    int maxPendingResults = 10000;
    long maxWaitToStartTimeMsecs = TimeUnit.MINUTES.toMillis(5);
    standingQueryRequest = new SubmitStandingQueryRequestImpl(query, resultAttributes, sortAttributes, lifespan, properties, mockFramework, filterBuilder, defaultUpdateFrequencyMsec, null, maxPendingResults, true, false, maxWaitToStartTimeMsecs);
    standingQueryRequest.register_callback(mockCallback2);
    String managerId = UUID.randomUUID().toString();
    rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), standingQueryRequest);
    rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), CreationMgrHelper.id());
}
Also used : NameValue(org.codice.alliance.nsili.common.UCO.NameValue) Query(org.codice.alliance.nsili.common.GIAS.Query) SortAttribute(org.codice.alliance.nsili.common.GIAS.SortAttribute) QueryLifeSpan(org.codice.alliance.nsili.common.GIAS.QueryLifeSpan) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) SubmitStandingQueryRequestImpl(org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl)

Example 7 with Query

use of org.codice.alliance.nsili.common.GIAS.Query in project alliance by codice.

the class NsiliSourceTest method testQueryByContentType.

@Test
public void testQueryByContentType() throws Exception {
    QueryImpl propertyIsLikeQuery = new QueryImpl(builder.attribute(Metacard.CONTENT_TYPE).is().equalTo().text(GMTI));
    SourceResponse sourceResponse = source.query(new QueryRequestImpl(propertyIsLikeQuery));
    ArgumentCaptor<Query> argumentCaptor = ArgumentCaptor.forClass(Query.class);
    verify(catalogMgr).submit_query(argumentCaptor.capture(), any(String[].class), any(SortAttribute[].class), any(NameValue[].class));
    assertThat(sourceResponse.getHits(), is(LONG));
    assertThat(argumentCaptor.getValue().bqs_query, is(GMTI_EQ_FILTER));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) SourceResponse(ddf.catalog.operation.SourceResponse) Query(org.codice.alliance.nsili.common.GIAS.Query) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) Test(org.junit.Test)

Example 8 with Query

use of org.codice.alliance.nsili.common.GIAS.Query in project alliance by codice.

the class NsiliSourceTest method testQueryAnyTextWildcardRepl.

@Test
public void testQueryAnyTextWildcardRepl() throws Exception {
    QueryImpl propertyIsLikeQuery = new QueryImpl(builder.attribute(Metacard.ANY_TEXT).is().like().text("*"));
    SourceResponse sourceResponse = source.query(new QueryRequestImpl(propertyIsLikeQuery));
    ArgumentCaptor<Query> argumentCaptor = ArgumentCaptor.forClass(Query.class);
    verify(catalogMgr).submit_query(argumentCaptor.capture(), any(String[].class), any(SortAttribute[].class), any(NameValue[].class));
    assertThat(sourceResponse.getHits(), is(LONG));
    assertThat(argumentCaptor.getValue().bqs_query, is(GMTI_LIKE_FILTER));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) SourceResponse(ddf.catalog.operation.SourceResponse) Query(org.codice.alliance.nsili.common.GIAS.Query) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) Test(org.junit.Test)

Example 9 with Query

use of org.codice.alliance.nsili.common.GIAS.Query in project alliance by codice.

the class SampleNsiliClient method logDetails.

private void logDetails(NameValue nameValue) {
    if (nameValue.aname != null && nameValue.value != null) {
        String value = getString(nameValue.value);
        if (nameValue.aname.equalsIgnoreCase("query")) {
            Query q = QueryHelper.extract(nameValue.value);
            value = q.bqs_query;
        }
        if (value != null) {
            LOGGER.info("\t\t {} = {}", nameValue.aname, value);
        } else {
            LOGGER.info("\t\t {} = {} (non-string)", nameValue.aname, nameValue.value);
        }
    }
}
Also used : Query(org.codice.alliance.nsili.common.GIAS.Query)

Aggregations

Query (org.codice.alliance.nsili.common.GIAS.Query)9 Test (org.junit.Test)4 SourceResponse (ddf.catalog.operation.SourceResponse)3 QueryImpl (ddf.catalog.operation.impl.QueryImpl)3 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)3 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)2 SecurityServiceException (ddf.security.service.SecurityServiceException)2 IOException (java.io.IOException)2 QueryLifeSpan (org.codice.alliance.nsili.common.GIAS.QueryLifeSpan)2 SortAttribute (org.codice.alliance.nsili.common.GIAS.SortAttribute)2 Before (org.junit.Before)2 InvalidName (org.omg.CORBA.ORBPackage.InvalidName)2 AdapterInactive (org.omg.PortableServer.POAManagerPackage.AdapterInactive)2 ServantNotActive (org.omg.PortableServer.POAPackage.ServantNotActive)2 WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)2 LifeEvent (org.codice.alliance.nsili.common.GIAS.LifeEvent)1 SubmitStandingQueryRequest (org.codice.alliance.nsili.common.GIAS.SubmitStandingQueryRequest)1 AbsTime (org.codice.alliance.nsili.common.UCO.AbsTime)1 Date (org.codice.alliance.nsili.common.UCO.Date)1 NameValue (org.codice.alliance.nsili.common.UCO.NameValue)1