Search in sources :

Example 1 with Query

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

the class NsiliSourceTest method testQueryAnyText.

@Test
public void testQueryAnyText() 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 2 with Query

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

the class AccessManagerImplTest method setUp.

@Before
public void setUp() throws Exception {
    setupCommonMocks();
    setupAccessMgrMocks();
    try {
        setupOrb();
        orbRunThread = new Thread(() -> orb.run());
        orbRunThread.start();
    } catch (InvalidName | AdapterInactive | WrongPolicy | ServantNotActive e) {
        LOGGER.error("Unable to start the CORBA server", e);
    } catch (IOException e) {
        LOGGER.error("Unable to generate the IOR file", e);
    } catch (SecurityServiceException e) {
        LOGGER.error("Unable to setup guest security credentials", e);
    }
    testQuery = new Query(NsiliConstants.NSIL_ALL_VIEW, bqsQuery);
    String managerId = UUID.randomUUID().toString();
    accessManager = new AccessManagerImpl();
    accessManager.setFilterBuilder(new GeotoolsFilterBuilder());
    accessManager.setCatalogFramework(mockCatalogFramework);
    if (!CorbaUtils.isIdActive(rootPOA, managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)))) {
        try {
            rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), accessManager);
        } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
            LOGGER.error("Error activating ProductMgr: {}", e);
        }
    }
    rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), ProductMgrHelper.id());
}
Also used : AccessManagerImpl(org.codice.alliance.nsili.endpoint.managers.AccessManagerImpl) SecurityServiceException(ddf.security.service.SecurityServiceException) Query(org.codice.alliance.nsili.common.GIAS.Query) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) AdapterInactive(org.omg.PortableServer.POAManagerPackage.AdapterInactive) ServantNotActive(org.omg.PortableServer.POAPackage.ServantNotActive) IOException(java.io.IOException) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive) Before(org.junit.Before)

Example 3 with Query

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

the class CatalogMgrImplTest method setUp.

@Before
public void setUp() throws Exception {
    setupCommonMocks();
    setupCatalogMgrMocks();
    try {
        setupOrb();
        orbRunThread = new Thread(() -> orb.run());
        orbRunThread.start();
    } catch (InvalidName | AdapterInactive | WrongPolicy | ServantNotActive e) {
        LOGGER.error("Unable to start the CORBA server", e);
    } catch (IOException e) {
        LOGGER.error("Unable to generate the IOR file", e);
    } catch (SecurityServiceException e) {
        LOGGER.error("Unable to setup guest security credentials", e);
    }
    testQuery = new Query(NsiliConstants.NSIL_ALL_VIEW, bqsQuery);
    catalogMgr = new CatalogMgrImpl(rootPOA, new GeotoolsFilterBuilder(), null);
    catalogMgr.setCatalogFramework(mockCatalogFramework);
}
Also used : WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) SecurityServiceException(ddf.security.service.SecurityServiceException) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) Query(org.codice.alliance.nsili.common.GIAS.Query) AdapterInactive(org.omg.PortableServer.POAManagerPackage.AdapterInactive) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) CatalogMgrImpl(org.codice.alliance.nsili.endpoint.managers.CatalogMgrImpl) ServantNotActive(org.omg.PortableServer.POAPackage.ServantNotActive) IOException(java.io.IOException) Before(org.junit.Before)

Example 4 with Query

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

the class StandingQueryMgrImplTest method testSubmitStandingQuery.

@Test
public void testSubmitStandingQuery() throws InvalidInputParameter, SystemFault, ProcessingFault {
    String[] resultAttributes = new String[0];
    SortAttribute[] sortAttributes = new SortAttribute[0];
    LifeEvent start = new LifeEvent();
    start.at(LifeEventType.ABSOLUTE_TIME, new AbsTime(new Date((short) 2016, (short) 05, (short) 01), new Time((short) 00, (short) 00, (short) 00)));
    LifeEvent stop = new LifeEvent();
    stop.at(LifeEventType.ABSOLUTE_TIME, new AbsTime(new Date((short) 2050, (short) 05, (short) 01), new Time((short) 00, (short) 00, (short) 00)));
    LifeEvent frequency1 = new LifeEvent();
    frequency1.rt(LifeEventType.RELATIVE_TIME, new Time((short) 00, (short) 01, (short) 00));
    LifeEvent[] frequency = new LifeEvent[] { frequency1 };
    QueryLifeSpan lifeSpan = new QueryLifeSpan(start, stop, frequency);
    Query query = new Query(NsiliConstants.NSIL_ALL_VIEW, bqsQuery);
    SubmitStandingQueryRequest request = standingQueryMgr.submit_standing_query(query, resultAttributes, sortAttributes, lifeSpan, new NameValue[0]);
    assertThat(request, notNullValue());
}
Also used : SubmitStandingQueryRequest(org.codice.alliance.nsili.common.GIAS.SubmitStandingQueryRequest) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) SortAttribute(org.codice.alliance.nsili.common.GIAS.SortAttribute) Query(org.codice.alliance.nsili.common.GIAS.Query) QueryLifeSpan(org.codice.alliance.nsili.common.GIAS.QueryLifeSpan) LifeEvent(org.codice.alliance.nsili.common.GIAS.LifeEvent) Time(org.codice.alliance.nsili.common.UCO.Time) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) Date(org.codice.alliance.nsili.common.UCO.Date) Test(org.junit.Test)

Example 5 with Query

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

the class SubmitStandingQueryRequestImplTest method getQuery.

private Query getQuery() {
    Query query = new Query();
    query.bqs_query = "NSIL_CARD.identifier like '%'";
    query.view = NsiliConstants.NSIL_ALL_VIEW;
    return query;
}
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