Search in sources :

Example 1 with DefaultContentResult

use of com.opentext.ia.sdk.client.impl.DefaultContentResult in project infoarchive-sip-sdk by Enterprise-Content-Management.

the class WhenUsingInfoArchive method shouldFetchOrderContentSuccessfully.

@Test
@SuppressWarnings("rawtypes")
public void shouldFetchOrderContentSuccessfully() throws IOException {
    UriBuilder uriBuilder = mock(UriBuilder.class);
    String uri = randomString();
    when(uriBuilder.build()).thenReturn(uri);
    when(uriBuilder.addParameter(anyString(), anyString())).thenReturn(uriBuilder);
    when(restClient.uri(anyString())).thenReturn(uriBuilder);
    ResponseFactory contentResultFactory = mock(ContentResultFactory.class);
    DefaultContentResult contentResult = mock(DefaultContentResult.class);
    when(contentResultFactory.create(any(Response.class), any(Runnable.class))).thenReturn(contentResult);
    when(restClient.get(eq(uri), any(ContentResultFactory.class))).thenReturn(contentResult);
    OrderItem orderItem = new OrderItem();
    orderItem.setType("EXPORT");
    Link downloadLink = new Link();
    downloadLink.setHref(randomString());
    orderItem.getLinks().put(LINK_DOWNLOAD, downloadLink);
    configureServer();
    ContentResult result = archiveClient.fetchOrderContent(orderItem);
    assertEquals(contentResult, result);
}
Also used : Response(com.opentext.ia.sdk.support.http.Response) ContentResult(com.opentext.ia.sdk.client.api.ContentResult) DefaultContentResult(com.opentext.ia.sdk.client.impl.DefaultContentResult) ResponseFactory(com.opentext.ia.sdk.support.http.ResponseFactory) DefaultContentResult(com.opentext.ia.sdk.client.impl.DefaultContentResult) ContentResultFactory(com.opentext.ia.sdk.client.impl.ContentResultFactory) StringContains.containsString(org.hamcrest.core.StringContains.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) UriBuilder(com.opentext.ia.sdk.support.http.UriBuilder) Link(com.opentext.ia.sdk.support.http.rest.Link) Test(org.junit.jupiter.api.Test)

Aggregations

ContentResult (com.opentext.ia.sdk.client.api.ContentResult)1 ContentResultFactory (com.opentext.ia.sdk.client.impl.ContentResultFactory)1 DefaultContentResult (com.opentext.ia.sdk.client.impl.DefaultContentResult)1 Response (com.opentext.ia.sdk.support.http.Response)1 ResponseFactory (com.opentext.ia.sdk.support.http.ResponseFactory)1 UriBuilder (com.opentext.ia.sdk.support.http.UriBuilder)1 Link (com.opentext.ia.sdk.support.http.rest.Link)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1 Test (org.junit.jupiter.api.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1