Search in sources :

Example 11 with Failure

use of org.folio.inventory.common.domain.Failure in project mod-inventory by folio-org.

the class ExternalAuthorityCollectionFailureExamples method serverErrorWhenUpdatingAnInstanceTriggersFailureCallback.

@Test
public void serverErrorWhenUpdatingAnInstanceTriggersFailureCallback() throws InterruptedException, ExecutionException, TimeoutException {
    AuthorityRecordCollection collection = createCollection();
    CompletableFuture<Failure> failureCalled = new CompletableFuture<>();
    collection.update(createAuthority(), success -> fail("Completion callback should not be called"), failureCalled::complete);
    Failure failure = failureCalled.get(1000, TimeUnit.MILLISECONDS);
    check(failure);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) AuthorityRecordCollection(org.folio.inventory.domain.AuthorityRecordCollection) Failure(org.folio.inventory.common.domain.Failure) Test(org.junit.Test)

Example 12 with Failure

use of org.folio.inventory.common.domain.Failure in project mod-inventory by folio-org.

the class ExternalAuthorityCollectionFailureExamples method serverErrorWhenDeletingAllInstancesTriggersFailureCallback.

@Test
public void serverErrorWhenDeletingAllInstancesTriggersFailureCallback() throws InterruptedException, ExecutionException, TimeoutException {
    AuthorityRecordCollection collection = createCollection();
    CompletableFuture<Failure> failureCalled = new CompletableFuture<>();
    collection.empty(success -> fail("Completion callback should not be called"), failureCalled::complete);
    Failure failure = failureCalled.get(1000, TimeUnit.MILLISECONDS);
    check(failure);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) AuthorityRecordCollection(org.folio.inventory.domain.AuthorityRecordCollection) Failure(org.folio.inventory.common.domain.Failure) Test(org.junit.Test)

Example 13 with Failure

use of org.folio.inventory.common.domain.Failure in project mod-inventory by folio-org.

the class ExternalInstanceCollectionFailureExamples method serverErrorWhenGettingAllInstancesTriggersFailureCallback.

@Test
public void serverErrorWhenGettingAllInstancesTriggersFailureCallback() throws InterruptedException, ExecutionException, TimeoutException {
    InstanceCollection collection = createCollection();
    CompletableFuture<Failure> failureCalled = new CompletableFuture<>();
    collection.findAll(PagingParameters.defaults(), success -> fail("Completion callback should not be called"), failureCalled::complete);
    Failure failure = failureCalled.get(1000, TimeUnit.MILLISECONDS);
    check(failure);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) InstanceCollection(org.folio.inventory.domain.instances.InstanceCollection) Failure(org.folio.inventory.common.domain.Failure) Test(org.junit.Test)

Example 14 with Failure

use of org.folio.inventory.common.domain.Failure in project mod-inventory by folio-org.

the class ExternalInstanceCollectionFailureExamples method serverErrorWhenFindingItemsTriggersFailureCallback.

@Test
public void serverErrorWhenFindingItemsTriggersFailureCallback() throws InterruptedException, ExecutionException, TimeoutException, UnsupportedEncodingException {
    InstanceCollection collection = createCollection();
    CompletableFuture<Failure> failureCalled = new CompletableFuture<>();
    collection.findByCql("title=\"*Small Angry*\"", new PagingParameters(10, 0), success -> fail("Completion callback should not be called"), failureCalled::complete);
    Failure failure = failureCalled.get(1000, TimeUnit.MILLISECONDS);
    check(failure);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) PagingParameters(org.folio.inventory.common.api.request.PagingParameters) InstanceCollection(org.folio.inventory.domain.instances.InstanceCollection) Failure(org.folio.inventory.common.domain.Failure) Test(org.junit.Test)

Example 15 with Failure

use of org.folio.inventory.common.domain.Failure in project mod-inventory by folio-org.

the class ExternalInstanceCollectionFailureExamples method serverErrorWhenUpdatingAnInstanceTriggersFailureCallback.

@Test
public void serverErrorWhenUpdatingAnInstanceTriggersFailureCallback() throws InterruptedException, ExecutionException, TimeoutException {
    InstanceCollection collection = createCollection();
    CompletableFuture<Failure> failureCalled = new CompletableFuture<>();
    collection.update(createInstance(), success -> fail("Completion callback should not be called"), failureCalled::complete);
    Failure failure = failureCalled.get(1000, TimeUnit.MILLISECONDS);
    check(failure);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) InstanceCollection(org.folio.inventory.domain.instances.InstanceCollection) Failure(org.folio.inventory.common.domain.Failure) Test(org.junit.Test)

Aggregations

Failure (org.folio.inventory.common.domain.Failure)50 Test (org.junit.Test)44 CompletableFuture (java.util.concurrent.CompletableFuture)26 HashMap (java.util.HashMap)21 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)18 DataImportEventPayload (org.folio.DataImportEventPayload)17 JsonObject (io.vertx.core.json.JsonObject)16 PagingParameters (org.folio.inventory.common.api.request.PagingParameters)10 Record (org.folio.rest.jaxrs.model.Record)10 ParsedRecord (org.folio.rest.jaxrs.model.ParsedRecord)9 Async (io.vertx.ext.unit.Async)8 Consumer (java.util.function.Consumer)7 HoldingsRecord (org.folio.HoldingsRecord)7 AuthorityRecordCollection (org.folio.inventory.domain.AuthorityRecordCollection)7 InstanceCollection (org.folio.inventory.domain.instances.InstanceCollection)7 ItemCollection (org.folio.inventory.domain.items.ItemCollection)6 EventHandler (org.folio.processing.events.services.handler.EventHandler)6 MultipleRecords (org.folio.inventory.common.domain.MultipleRecords)4 Instance (org.folio.inventory.domain.instances.Instance)4 Reader (org.folio.processing.mapping.mapper.reader.Reader)4