use of org.codice.alliance.nsili.common.GIAS.SortAttribute in project alliance by codice.
the class CatalogMgrImplTest method testQuery.
@Test
public void testQuery() throws InvalidInputParameter, SystemFault, ProcessingFault {
String[] resultAttributes = null;
SortAttribute[] sortAttributes = null;
catalogMgr.setMaxNumResults(999);
catalogMgr.set_default_timeout(AccessManagerImpl.DEFAULT_TIMEOUT);
SubmitQueryRequest submitQueryRequest = catalogMgr.submit_query(testQuery, resultAttributes, sortAttributes, null);
assertThat(submitQueryRequest, notNullValue());
DAGListHolder dagListHolder = new DAGListHolder();
submitQueryRequest.complete_DAG_results(dagListHolder);
assertThat(dagListHolder.value, notNullValue());
assertThat(dagListHolder.value.length, is(2));
}
use of org.codice.alliance.nsili.common.GIAS.SortAttribute in project alliance by codice.
the class SampleNsiliClient method testCallbackCatalogMgr.
public void testCallbackCatalogMgr() throws Exception {
if (catalogMgr != null) {
LOGGER.info("Testing Query Results via Callback ...");
SortAttribute[] sortAttributes = getSortableAttributes();
String[] resultAttributes = getResultAttributes();
LOGGER.info("Query: {}", STANDING_ALL_QUERY.bqs_query);
SubmitQueryRequest catalogSearchQueryRequest = catalogMgr.submit_query(STANDING_ALL_QUERY, resultAttributes, sortAttributes, new NameValue[0]);
catalogSearchQueryRequest.set_user_info(ALLIANCE);
catalogSearchQueryRequest.set_number_of_hits(200);
TestNsiliCallback nsiliCallback = new TestNsiliCallback(catalogSearchQueryRequest);
byte[] poaObjId = poa.activate_object(nsiliCallback);
org.omg.CORBA.Object obj = poa.id_to_reference(poaObjId);
String catalogSearchCallbackID = catalogSearchQueryRequest.register_callback(CallbackHelper.narrow(obj));
nsiliCallback.setCallbackID(catalogSearchCallbackID);
callbacks.add(nsiliCallback);
LOGGER.info("Callback Catalog Mgr Callback registered: {}", catalogSearchCallbackID);
} else {
LOGGER.warn("CatalogMgr is not initialized, unable to submit queries");
}
}
use of org.codice.alliance.nsili.common.GIAS.SortAttribute in project alliance by codice.
the class SampleNsiliClient method getSortableAttributes.
private SortAttribute[] getSortableAttributes() throws InvalidInputParameter, SystemFault, ProcessingFault {
List<SortAttribute> sortableAttributesList = new ArrayList<>();
AttributeInformation[] attributeInformationArray = dataModelMgr.get_attributes(NsiliConstants.NSIL_ALL_VIEW, new NameValue[0]);
for (AttributeInformation attributeInformation : attributeInformationArray) {
if (attributeInformation.sortable) {
sortableAttributesList.add(new SortAttribute(attributeInformation.attribute_name, Polarity.DESCENDING));
}
}
return sortableAttributesList.toArray(new SortAttribute[sortableAttributesList.size()]);
}
Aggregations