use of com.opentext.ia.sdk.support.http.rest.Link in project infoarchive-sip-sdk by Enterprise-Content-Management.
the class WhenConfiguringServerUsingYaml method shouldDeferToServerWhenItSupportsYamlConfiguration.
@Test
void shouldDeferToServerWhenItSupportsYamlConfiguration() throws IOException {
String configurationUri = randomUri();
Services services = new Services();
services.getLinks().put(LINK_CONFIGURATION, new Link(configurationUri));
when(httpClient.get(any(), any(), eq(Services.class))).thenReturn(services);
configurer.configure(connection);
verify(httpClient).put(eq(configurationUri), any(), eq(String.class), anyString());
verify(clientSideConfigurer, never()).configure(any());
}
use of com.opentext.ia.sdk.support.http.rest.Link in project infoarchive-sip-sdk by Enterprise-Content-Management.
the class WhenUsingInfoArchive method shouldIngestWithIngestDirect.
@Test
void shouldIngestWithIngestDirect() throws IOException {
Link link = new Link();
link.setHref(BILLBOARD_URI);
links.put(InfoArchiveLinkRelations.LINK_INGEST_DIRECT, link);
configureServer();
InputStream sip = IOUtils.toInputStream(SOURCE, StandardCharsets.UTF_8);
IngestionResponse ingestionResponse = mock(IngestionResponse.class);
when(restClient.post(anyString(), eq(IngestionResponse.class), any(Part.class), any(Part.class))).thenReturn(ingestionResponse);
String aipId = "sip002";
when(ingestionResponse.getAipId()).thenReturn(aipId);
assertEquals(aipId, archiveClient.ingestDirect(sip), "AIP ID");
}
use of com.opentext.ia.sdk.support.http.rest.Link in project infoarchive-sip-sdk by Enterprise-Content-Management.
the class WhenUsingInfoArchive method getJobInstanceLog.
@Test
void getJobInstanceLog() throws IOException {
JobInstance jobInstance = new JobInstance();
Map<String, Link> link = new HashMap<>();
link.put(InfoArchiveLinkRelations.LINK_LOG, new Link("uri-for-jobinstance-log"));
jobInstance.setLinks(link);
when(restClient.get("uri-for-jobinstance-log", String.class)).thenReturn("id: abc, \"logMessages\" : [ { sample data } ]");
String logJson = JobsUtil.getLog(jobInstance, connection.getRestClient());
assertThat(logJson, notNullValue());
assertThat(logJson, containsString("\"logMessages\" : [ {"));
}
use of com.opentext.ia.sdk.support.http.rest.Link in project infoarchive-sip-sdk by Enterprise-Content-Management.
the class WhenUsingInfoArchive method getBatchItemLog.
@Test
void getBatchItemLog() throws IOException {
BatchItem firstBatchItem = new BatchItem();
Map<String, Link> link = new HashMap<>();
link.put(InfoArchiveLinkRelations.LINK_LOG, new Link("uri-for-batchitem-log"));
firstBatchItem.setLinks(link);
when(restClient.get("uri-for-batchitem-log", String.class)).thenReturn("id: abc, \"logMessages\" : [ { sample data } ]");
String logJson = JobsUtil.getLog(firstBatchItem, connection.getRestClient());
assertThat(logJson, notNullValue());
assertThat(logJson, containsString("\"logMessages\" : [ {"));
}
Aggregations