use of com.opentext.ia.sdk.client.api.ContentResult 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);
}
Aggregations