use of org.omg.CORBA.IntHolder in project alliance by codice.
the class NsiliSourceTest method getMockCatalogMgr.
private CatalogMgr getMockCatalogMgr() throws Exception {
SubmitQueryRequest submitQueryRequest = mock(SubmitQueryRequest.class);
HitCountRequest hitCountRequest = mock(HitCountRequest.class);
doReturn(State.COMPLETED).when(hitCountRequest).complete(any(IntHolder.class));
Status status = new Status();
status.completion_state = State.COMPLETED;
doReturn(status).when(hitCountRequest).get_status();
when(hitCountRequest.complete(any(IntHolder.class))).thenAnswer((InvocationOnMock invocationOnMock) -> {
IntHolder intHolder = (IntHolder) invocationOnMock.getArguments()[0];
intHolder.value = 12;
return State.COMPLETED;
});
when(submitQueryRequest.complete_DAG_results(any(DAGListHolder.class))).thenAnswer((InvocationOnMock invocationOnMock) -> {
DAGListHolder dagListHolder = (DAGListHolder) invocationOnMock.getArguments()[0];
dagListHolder.value = getMockDAGArray();
return State.COMPLETED;
});
doReturn(submitQueryRequest).when(catalogMgr).submit_query(any(Query.class), any(String[].class), any(SortAttribute[].class), any(NameValue[].class));
doReturn(hitCountRequest).when(catalogMgr).hit_count(any(Query.class), any(NameValue[].class));
return catalogMgr;
}
use of org.omg.CORBA.IntHolder in project alliance by codice.
the class CatalogMgrImplTest method testHitCount.
@Test
public void testHitCount() throws InvalidInputParameter, SystemFault, ProcessingFault {
catalogMgr.set_default_timeout(AccessManagerImpl.DEFAULT_TIMEOUT);
HitCountRequest hitCountRequest = catalogMgr.hit_count(testQuery, null);
IntHolder hitHolder = new IntHolder();
assertThat(hitCountRequest, notNullValue());
hitCountRequest.complete(hitHolder);
assertThat(hitHolder.value, greaterThan(0));
}
Aggregations