Search in sources :

Example 1 with Status

use of org.codice.alliance.nsili.common.UCO.Status in project alliance by codice.

the class SubmitStandingQueryRequestImplTest method testCancel.

@Test
public void testCancel() throws SystemFault, ProcessingFault, InvalidInputParameter, WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive {
    standingQueryRequest.cancel();
    Status status = standingQueryRequest.get_status();
    assertThat(status.completion_state, is(State.CANCELED));
    setupStandingQueryRequest();
}
Also used : Status(org.codice.alliance.nsili.common.UCO.Status) Test(org.junit.Test)

Example 2 with Status

use of org.codice.alliance.nsili.common.UCO.Status in project alliance by codice.

the class SubmitStandingQueryRequestImplTest method testPauseResume.

@Test
public void testPauseResume() throws SystemFault, ProcessingFault {
    standingQueryRequest.pause();
    Status status = standingQueryRequest.get_status();
    assertThat(status.completion_state, is(State.SUSPENDED));
    standingQueryRequest.resume();
    status = standingQueryRequest.get_status();
    assertThat(status.completion_state, is(State.PENDING));
}
Also used : Status(org.codice.alliance.nsili.common.UCO.Status) Test(org.junit.Test)

Example 3 with Status

use of org.codice.alliance.nsili.common.UCO.Status in project alliance by codice.

the class OrderRequestImplTest method testGetStatus.

@Test
public void testGetStatus() throws SystemFault, ProcessingFault {
    OrderContents order = getUncompressedTestOrder();
    OrderRequestImpl orderRequest = new OrderRequestImpl(order, PROTOCOL, PORT, accessManager, mockCatalogFramework, emailConfiguration);
    Status status = orderRequest.get_status();
    assertThat(status, notNullValue());
}
Also used : Status(org.codice.alliance.nsili.common.UCO.Status) OrderContents(org.codice.alliance.nsili.common.GIAS.OrderContents) Test(org.junit.Test)

Example 4 with Status

use of org.codice.alliance.nsili.common.UCO.Status 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;
}
Also used : Status(org.codice.alliance.nsili.common.UCO.Status) SubmitQueryRequest(org.codice.alliance.nsili.common.GIAS.SubmitQueryRequest) Query(org.codice.alliance.nsili.common.GIAS.Query) InvocationOnMock(org.mockito.invocation.InvocationOnMock) IntHolder(org.omg.CORBA.IntHolder) HitCountRequest(org.codice.alliance.nsili.common.GIAS.HitCountRequest) DAGListHolder(org.codice.alliance.nsili.common.UCO.DAGListHolder)

Aggregations

Status (org.codice.alliance.nsili.common.UCO.Status)4 Test (org.junit.Test)3 HitCountRequest (org.codice.alliance.nsili.common.GIAS.HitCountRequest)1 OrderContents (org.codice.alliance.nsili.common.GIAS.OrderContents)1 Query (org.codice.alliance.nsili.common.GIAS.Query)1 SubmitQueryRequest (org.codice.alliance.nsili.common.GIAS.SubmitQueryRequest)1 DAGListHolder (org.codice.alliance.nsili.common.UCO.DAGListHolder)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 IntHolder (org.omg.CORBA.IntHolder)1