Search in sources :

Example 1 with SubmitStandingQueryRequestImpl

use of org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl 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 2 with SubmitStandingQueryRequestImpl

use of org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl in project alliance by codice.

the class StandingQueryMgrImpl method submit_standing_query.

@Override
public SubmitStandingQueryRequest submit_standing_query(Query aQuery, String[] result_attributes, SortAttribute[] sort_attributes, QueryLifeSpan lifespan, NameValue[] properties) throws InvalidInputParameter, ProcessingFault, SystemFault {
    if (aQuery == null) {
        InvalidInputParameter except = new InvalidInputParameter();
        exception_details details = new exception_details();
        details.exception_name = "No Query Specified";
        details.exception_desc = "Query must be specified for standing query request";
        except.details = details;
        throw except;
    }
    LOGGER.debug("Registering Standing Query View: {}, BQS: {}", aQuery.view, aQuery.bqs_query);
    SubmitStandingQueryRequestImpl standingQueryRequest = new SubmitStandingQueryRequestImpl(aQuery, result_attributes, sort_attributes, lifespan, properties, catalogFramework, filterBuilder, defaultUpdateFrequencyMsec, querySources, maxPendingResults, removeSourceLibrary, outgoingValidationEnabled, maxWaitToStartTimeMsecs);
    String id = UUID.randomUUID().toString();
    try {
        _poa().activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), standingQueryRequest);
    } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
        LOGGER.debug("submit_standing_query : Unable to activate submitStandingQueryRequest object.", e);
    }
    org.omg.CORBA.Object obj = _poa().create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), SubmitStandingQueryRequestHelper.id());
    SubmitStandingQueryRequest submitStandingQueryRequest = SubmitStandingQueryRequestHelper.narrow(obj);
    return submitStandingQueryRequest;
}
Also used : SubmitStandingQueryRequest(org.codice.alliance.nsili.common.GIAS.SubmitStandingQueryRequest) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) UCO.exception_details(org.codice.alliance.nsili.common.UCO.exception_details) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) InvalidInputParameter(org.codice.alliance.nsili.common.UCO.InvalidInputParameter) SubmitStandingQueryRequestImpl(org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive)

Aggregations

SubmitStandingQueryRequestImpl (org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl)2 Query (org.codice.alliance.nsili.common.GIAS.Query)1 QueryLifeSpan (org.codice.alliance.nsili.common.GIAS.QueryLifeSpan)1 SortAttribute (org.codice.alliance.nsili.common.GIAS.SortAttribute)1 SubmitStandingQueryRequest (org.codice.alliance.nsili.common.GIAS.SubmitStandingQueryRequest)1 InvalidInputParameter (org.codice.alliance.nsili.common.UCO.InvalidInputParameter)1 NameValue (org.codice.alliance.nsili.common.UCO.NameValue)1 UCO.exception_details (org.codice.alliance.nsili.common.UCO.exception_details)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)1 ServantAlreadyActive (org.omg.PortableServer.POAPackage.ServantAlreadyActive)1 WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)1