Search in sources :

Example 1 with Services

use of com.opentext.ia.sdk.dto.Services in project infoarchive-sip-sdk by Enterprise-Content-Management.

the class ArchiveConnection method getServerVersion.

public String getServerVersion() throws IOException {
    if (serverVersion != null) {
        return serverVersion;
    }
    Services services = getServices();
    ProductInfo productInfo = getRestClient().follow(services, InfoArchiveLinkRelations.LINK_PRODUCT_INFO, ProductInfo.class);
    if (productInfo == null) {
        throw new IllegalStateException("Cannot determine server version");
    }
    serverVersion = productInfo.getBuildProperties().getServerVersion();
    return serverVersion;
}
Also used : Services(com.opentext.ia.sdk.dto.Services) ProductInfo(com.opentext.ia.sdk.dto.ProductInfo)

Example 2 with Services

use of com.opentext.ia.sdk.dto.Services in project infoarchive-sip-sdk by Enterprise-Content-Management.

the class ArchiveClients method appResourceCache.

private static ApplicationIngestionResourcesCache appResourceCache(String applicationName, ArchiveConnection connection, RestClient restClient) throws IOException {
    ApplicationIngestionResourcesCache resourceCache = new ApplicationIngestionResourcesCache(applicationName);
    Services services = connection.getServices();
    ProductInfo productInfo = getProductInfo(restClient, services);
    Tenant tenant = getTenant(restClient, services);
    Application application = getApplication(restClient, tenant, applicationName);
    cacheResourceUris(restClient, services, productInfo, application, resourceCache);
    return resourceCache;
}
Also used : Services(com.opentext.ia.sdk.dto.Services) ProductInfo(com.opentext.ia.sdk.dto.ProductInfo) ApplicationIngestionResourcesCache(com.opentext.ia.sdk.client.impl.ApplicationIngestionResourcesCache) Tenant(com.opentext.ia.sdk.dto.Tenant) Application(com.opentext.ia.sdk.dto.Application)

Example 3 with Services

use of com.opentext.ia.sdk.dto.Services in project infoarchive-sip-sdk by Enterprise-Content-Management.

the class WhenConfiguringServerUsingYaml method shouldConfigureFromClientWhenServerDoesntSupportsYamlConfiguration.

@Test
void shouldConfigureFromClientWhenServerDoesntSupportsYamlConfiguration() throws IOException {
    Services services = new Services();
    when(httpClient.get(any(), any(), eq(Services.class))).thenReturn(services);
    configurer.configure(connection);
    verify(clientSideConfigurer).configure(any());
    verify(httpClient, never()).put(anyString(), any(), any(), anyString());
}
Also used : Services(com.opentext.ia.sdk.dto.Services) Test(org.junit.jupiter.api.Test)

Example 4 with Services

use of com.opentext.ia.sdk.dto.Services 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());
}
Also used : Services(com.opentext.ia.sdk.dto.Services) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Link(com.opentext.ia.sdk.support.http.rest.Link) Test(org.junit.jupiter.api.Test)

Example 5 with Services

use of com.opentext.ia.sdk.dto.Services in project infoarchive-sip-sdk by Enterprise-Content-Management.

the class InfoArchiveRestClient method search.

@Override
public JobInstance search(String jobName, String applicationName, String tenantName) throws IOException {
    Services services = restClient.get(resourceCache.getServicesUri(), Services.class);
    JobDefinitions jobDefinitions = restClient.followNonPaged(services, InfoArchiveLinkRelations.LINK_JOB_DEFINITIONS, JobDefinitions.class);
    JobDefinition jobDefinition = jobDefinitions.byName(jobName);
    String runLink = jobDefinition.getUri(InfoArchiveLinkRelations.LINK_JOB_INSTANCES);
    JobInstanceFilter jobSettings = new JobInstanceFilter();
    jobSettings.setNow(true);
    if (applicationName != null) {
        jobSettings.setApplication(applicationName);
    }
    if (tenantName != null) {
        jobSettings.setTenant(applicationName);
    }
    return restClient.post(runLink, JobInstance.class, jobSettings);
}
Also used : Services(com.opentext.ia.sdk.dto.Services) JobDefinitions(com.opentext.ia.sdk.dto.JobDefinitions) JobDefinition(com.opentext.ia.sdk.dto.JobDefinition) JobInstanceFilter(com.opentext.ia.sdk.dto.JobInstanceFilter)

Aggregations

Services (com.opentext.ia.sdk.dto.Services)5 ProductInfo (com.opentext.ia.sdk.dto.ProductInfo)2 Test (org.junit.jupiter.api.Test)2 ApplicationIngestionResourcesCache (com.opentext.ia.sdk.client.impl.ApplicationIngestionResourcesCache)1 Application (com.opentext.ia.sdk.dto.Application)1 JobDefinition (com.opentext.ia.sdk.dto.JobDefinition)1 JobDefinitions (com.opentext.ia.sdk.dto.JobDefinitions)1 JobInstanceFilter (com.opentext.ia.sdk.dto.JobInstanceFilter)1 Tenant (com.opentext.ia.sdk.dto.Tenant)1 Link (com.opentext.ia.sdk.support.http.rest.Link)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1