Search in sources :

Example 1 with ControlledVocabularyPreparation

use of api.support.ControlledVocabularyPreparation in project mod-inventory by folio-org.

the class ApiTestSuite method createInstanceTypes.

private static void createInstanceTypes() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
    OkapiHttpClient client = createOkapiHttpClient();
    URL instanceTypes = new URL(String.format("%s/instance-types", storageOkapiUrl()));
    ControlledVocabularyPreparation instanceTypesPreparation = new ControlledVocabularyPreparation(client, instanceTypes, "instanceTypes");
    textInstanceTypeId = instanceTypesPreparation.createOrReferenceTerm("text", "txt", "rdacontent");
}
Also used : OkapiHttpClient(org.folio.inventory.support.http.client.OkapiHttpClient) ControlledVocabularyPreparation(api.support.ControlledVocabularyPreparation) URL(java.net.URL)

Example 2 with ControlledVocabularyPreparation

use of api.support.ControlledVocabularyPreparation in project mod-inventory by folio-org.

the class ApiTestSuite method createIdentifierTypes.

private static void createIdentifierTypes() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
    OkapiHttpClient client = createOkapiHttpClient();
    URL identifierTypesUrl = new URL(String.format("%s/identifier-types", storageOkapiUrl()));
    ControlledVocabularyPreparation identifierTypesPreparation = new ControlledVocabularyPreparation(client, identifierTypesUrl, "identifierTypes");
    isbnIdentifierTypeId = identifierTypesPreparation.createOrReferenceTerm("ISBN");
    asinIdentifierTypeId = identifierTypesPreparation.createOrReferenceTerm("ASIN");
}
Also used : OkapiHttpClient(org.folio.inventory.support.http.client.OkapiHttpClient) ControlledVocabularyPreparation(api.support.ControlledVocabularyPreparation) URL(java.net.URL)

Example 3 with ControlledVocabularyPreparation

use of api.support.ControlledVocabularyPreparation in project mod-inventory by folio-org.

the class ApiTestSuite method createContributorNameTypes.

private static void createContributorNameTypes() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
    OkapiHttpClient client = createOkapiHttpClient();
    URL contributorNameTypes = new URL(String.format("%s/contributor-name-types", storageOkapiUrl()));
    ControlledVocabularyPreparation contributorNameTypesPreparation = new ControlledVocabularyPreparation(client, contributorNameTypes, "contributorNameTypes");
    personalContributorNameTypeId = contributorNameTypesPreparation.createOrReferenceTerm("Personal name");
}
Also used : OkapiHttpClient(org.folio.inventory.support.http.client.OkapiHttpClient) ControlledVocabularyPreparation(api.support.ControlledVocabularyPreparation) URL(java.net.URL)

Example 4 with ControlledVocabularyPreparation

use of api.support.ControlledVocabularyPreparation in project mod-inventory by folio-org.

the class ApiTestSuite method createMaterialTypes.

private static void createMaterialTypes() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
    OkapiHttpClient client = createOkapiHttpClient();
    URL materialTypesUrl = new URL(String.format("%s/material-types", storageOkapiUrl()));
    ControlledVocabularyPreparation materialTypePreparation = new ControlledVocabularyPreparation(client, materialTypesUrl, "mtypes");
    bookMaterialTypeId = materialTypePreparation.createOrReferenceTerm("Book");
    dvdMaterialTypeId = materialTypePreparation.createOrReferenceTerm("DVD");
}
Also used : OkapiHttpClient(org.folio.inventory.support.http.client.OkapiHttpClient) ControlledVocabularyPreparation(api.support.ControlledVocabularyPreparation) URL(java.net.URL)

Example 5 with ControlledVocabularyPreparation

use of api.support.ControlledVocabularyPreparation in project mod-inventory by folio-org.

the class ReferenceRecordClientExamples method before.

@Before
public void before() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
    OkapiHttpClient okapiHttpClient = ExternalStorageSuite.createOkapiHttpClient();
    URL materialTypesUrl = new URL(String.format("%s/%s", ExternalStorageSuite.getStorageAddress(), "/material-types"));
    CollectionResourceClient collectionResourceClient = new CollectionResourceClient(okapiHttpClient, materialTypesUrl);
    referenceClient = new ReferenceRecordClient(collectionResourceClient, "mtypes");
    CompletableFuture<Void> allDeleted = new CompletableFuture<>();
    collectionResourceClient.delete(response -> {
        if (response.getStatusCode() == 204) {
            allDeleted.complete(null);
        } else {
            allDeleted.completeExceptionally(new Exception(response.getBody()));
        }
    });
    waitForCompletion(allDeleted);
    preparation = new ControlledVocabularyPreparation(okapiHttpClient, materialTypesUrl, "mtypes");
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) OkapiHttpClient(org.folio.inventory.support.http.client.OkapiHttpClient) ControlledVocabularyPreparation(api.support.ControlledVocabularyPreparation) URL(java.net.URL) MalformedURLException(java.net.MalformedURLException) TimeoutException(java.util.concurrent.TimeoutException) ExecutionException(java.util.concurrent.ExecutionException) ExpectedException(org.junit.rules.ExpectedException) Before(org.junit.Before)

Aggregations

ControlledVocabularyPreparation (api.support.ControlledVocabularyPreparation)6 URL (java.net.URL)6 OkapiHttpClient (org.folio.inventory.support.http.client.OkapiHttpClient)6 MalformedURLException (java.net.MalformedURLException)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 Before (org.junit.Before)1 ExpectedException (org.junit.rules.ExpectedException)1