Search in sources :

Example 1 with TENANT_ID

use of org.folio.rest.api.StorageTestSuite.TENANT_ID in project mod-inventory-storage by folio-org.

the class HridSettingsStorageTest method canGetNextInstanceHridWithoutLeadingZeroes.

@Test
public void canGetNextInstanceHridWithoutLeadingZeroes(TestContext testContext) {
    log.info("Starting canGetNextInstanceHrid()");
    final Vertx vertx = StorageTestSuite.getVertx();
    final PostgresClient postgresClient = PostgresClient.getInstance(vertx, TENANT_ID);
    final HridManager hridManager = new HridManager(vertx.getOrCreateContext(), postgresClient);
    hridManager.updateHridSettings(initialHridSettingsWithoutLeadingZeroes).onComplete(testContext.asyncAssertSuccess(hridSettingsResult -> hridManager.getNextInstanceHrid().compose(hrid -> validateHrid(hrid, "in1", testContext)).onComplete(testContext.asyncAssertSuccess(v -> log.info("Finished canGetNextInstanceHridWithoutLeadingZeroes()")))));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) TestContext(io.vertx.ext.unit.TestContext) Async(io.vertx.ext.unit.Async) Response(org.folio.rest.support.Response) TENANT_ID(org.folio.rest.api.StorageTestSuite.TENANT_ID) CoreMatchers.not(org.hamcrest.CoreMatchers.not) RunWith(org.junit.runner.RunWith) TimeoutException(java.util.concurrent.TimeoutException) CompletableFuture(java.util.concurrent.CompletableFuture) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) HridSettings(org.folio.rest.jaxrs.model.HridSettings) InterfaceUrls(org.folio.rest.support.http.InterfaceUrls) Before(org.junit.Before) HridSetting(org.folio.rest.jaxrs.model.HridSetting) Promise(io.vertx.core.Promise) Vertx(io.vertx.core.Vertx) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) UUID(java.util.UUID) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) ResponseHandler.text(org.folio.rest.support.ResponseHandler.text) Future(io.vertx.core.Future) PostgresClient(org.folio.rest.persist.PostgresClient) HridManager(org.folio.rest.support.HridManager) ExecutionException(java.util.concurrent.ExecutionException) ResponseHandler.empty(org.folio.rest.support.ResponseHandler.empty) Logger(org.apache.logging.log4j.Logger) IsNull.notNullValue(org.hamcrest.core.IsNull.notNullValue) Row(io.vertx.sqlclient.Row) ResponseHandler.json(org.folio.rest.support.ResponseHandler.json) LogManager(org.apache.logging.log4j.LogManager) SECONDS(java.util.concurrent.TimeUnit.SECONDS) HridManager(org.folio.rest.support.HridManager) PostgresClient(org.folio.rest.persist.PostgresClient) Vertx(io.vertx.core.Vertx) Test(org.junit.Test)

Example 2 with TENANT_ID

use of org.folio.rest.api.StorageTestSuite.TENANT_ID in project mod-inventory-storage by folio-org.

the class HridSettingsStorageTest method canGetNextItemHridMultipleTimes.

@Test
public void canGetNextItemHridMultipleTimes(TestContext testContext) {
    log.info("Starting canGetNextItemHridMultipleTimes()");
    final Vertx vertx = StorageTestSuite.getVertx();
    final PostgresClient postgresClient = PostgresClient.getInstance(vertx, TENANT_ID);
    final HridManager hridManager = new HridManager(vertx.getOrCreateContext(), postgresClient);
    hridManager.getNextItemHrid().compose(hrid -> validateHrid(hrid, "it00000000001", testContext)).compose(v -> hridManager.getNextItemHrid()).compose(hrid -> validateHrid(hrid, "it00000000002", testContext)).compose(v -> hridManager.getNextItemHrid()).compose(hrid -> validateHrid(hrid, "it00000000003", testContext)).compose(v -> hridManager.getNextItemHrid()).compose(hrid -> validateHrid(hrid, "it00000000004", testContext)).compose(v -> hridManager.getNextItemHrid()).compose(hrid -> validateHrid(hrid, "it00000000005", testContext)).onComplete(testContext.asyncAssertSuccess(v -> log.info("Finished canGetNextItemHridMultipleTimes()")));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) TestContext(io.vertx.ext.unit.TestContext) Async(io.vertx.ext.unit.Async) Response(org.folio.rest.support.Response) TENANT_ID(org.folio.rest.api.StorageTestSuite.TENANT_ID) CoreMatchers.not(org.hamcrest.CoreMatchers.not) RunWith(org.junit.runner.RunWith) TimeoutException(java.util.concurrent.TimeoutException) CompletableFuture(java.util.concurrent.CompletableFuture) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) HridSettings(org.folio.rest.jaxrs.model.HridSettings) InterfaceUrls(org.folio.rest.support.http.InterfaceUrls) Before(org.junit.Before) HridSetting(org.folio.rest.jaxrs.model.HridSetting) Promise(io.vertx.core.Promise) Vertx(io.vertx.core.Vertx) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) UUID(java.util.UUID) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) ResponseHandler.text(org.folio.rest.support.ResponseHandler.text) Future(io.vertx.core.Future) PostgresClient(org.folio.rest.persist.PostgresClient) HridManager(org.folio.rest.support.HridManager) ExecutionException(java.util.concurrent.ExecutionException) ResponseHandler.empty(org.folio.rest.support.ResponseHandler.empty) Logger(org.apache.logging.log4j.Logger) IsNull.notNullValue(org.hamcrest.core.IsNull.notNullValue) Row(io.vertx.sqlclient.Row) ResponseHandler.json(org.folio.rest.support.ResponseHandler.json) LogManager(org.apache.logging.log4j.LogManager) SECONDS(java.util.concurrent.TimeUnit.SECONDS) HridManager(org.folio.rest.support.HridManager) PostgresClient(org.folio.rest.persist.PostgresClient) Vertx(io.vertx.core.Vertx) Test(org.junit.Test)

Example 3 with TENANT_ID

use of org.folio.rest.api.StorageTestSuite.TENANT_ID in project mod-inventory-storage by folio-org.

the class HridSettingsStorageTest method canGetNextHoldingHridWithoutLeadingZeroes.

@Test
public void canGetNextHoldingHridWithoutLeadingZeroes(TestContext testContext) {
    log.info("Starting canGetNextHoldingHridWithoutLeadingZeroes()");
    final Vertx vertx = StorageTestSuite.getVertx();
    final PostgresClient postgresClient = PostgresClient.getInstance(vertx, TENANT_ID);
    final HridManager hridManager = new HridManager(vertx.getOrCreateContext(), postgresClient);
    hridManager.updateHridSettings(initialHridSettingsWithoutLeadingZeroes).onComplete(testContext.asyncAssertSuccess(hridSettingsResult -> hridManager.getNextHoldingsHrid().compose(hrid -> validateHrid(hrid, "ho1", testContext)).onComplete(testContext.asyncAssertSuccess(v -> log.info("Finished canGetNextHoldingHridWithoutLeadingZeroes()")))));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) TestContext(io.vertx.ext.unit.TestContext) Async(io.vertx.ext.unit.Async) Response(org.folio.rest.support.Response) TENANT_ID(org.folio.rest.api.StorageTestSuite.TENANT_ID) CoreMatchers.not(org.hamcrest.CoreMatchers.not) RunWith(org.junit.runner.RunWith) TimeoutException(java.util.concurrent.TimeoutException) CompletableFuture(java.util.concurrent.CompletableFuture) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) HridSettings(org.folio.rest.jaxrs.model.HridSettings) InterfaceUrls(org.folio.rest.support.http.InterfaceUrls) Before(org.junit.Before) HridSetting(org.folio.rest.jaxrs.model.HridSetting) Promise(io.vertx.core.Promise) Vertx(io.vertx.core.Vertx) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) UUID(java.util.UUID) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) ResponseHandler.text(org.folio.rest.support.ResponseHandler.text) Future(io.vertx.core.Future) PostgresClient(org.folio.rest.persist.PostgresClient) HridManager(org.folio.rest.support.HridManager) ExecutionException(java.util.concurrent.ExecutionException) ResponseHandler.empty(org.folio.rest.support.ResponseHandler.empty) Logger(org.apache.logging.log4j.Logger) IsNull.notNullValue(org.hamcrest.core.IsNull.notNullValue) Row(io.vertx.sqlclient.Row) ResponseHandler.json(org.folio.rest.support.ResponseHandler.json) LogManager(org.apache.logging.log4j.LogManager) SECONDS(java.util.concurrent.TimeUnit.SECONDS) HridManager(org.folio.rest.support.HridManager) PostgresClient(org.folio.rest.persist.PostgresClient) Vertx(io.vertx.core.Vertx) Test(org.junit.Test)

Example 4 with TENANT_ID

use of org.folio.rest.api.StorageTestSuite.TENANT_ID in project mod-inventory-storage by folio-org.

the class InstanceStorageTest method insert.

/**
 * Insert n records into instance table where the title field is build using
 * prefix and the number from 1 .. n.
 */
private void insert(TestContext testContext, PostgresClient pg, String prefix, int n) {
    Async async = testContext.async();
    String table = PostgresClient.convertToPsqlStandard(TENANT_ID) + ".instance";
    String sql = "INSERT INTO " + table + " SELECT uuid, json_build_object('title', prefix || n, 'id', uuid)" + " FROM (SELECT n, prefix, md5(prefix || n)::uuid AS uuid" + "       FROM (SELECT generate_series(1, " + n + ") AS n, '" + prefix + " ' AS prefix) AS tmp1" + "      ) AS tmp2";
    pg.execute(sql, testContext.asyncAssertSuccess(updated -> {
        testContext.assertEquals(n, updated.rowCount());
        async.complete();
    }));
    async.await(10000);
}
Also used : HttpURLConnection(java.net.HttpURLConnection) ResponseHandler(org.folio.rest.support.ResponseHandler) Arrays(java.util.Arrays) TENANT_ID(org.folio.rest.api.StorageTestSuite.TENANT_ID) Matchers.not(org.hamcrest.Matchers.not) StringUtils(org.apache.commons.lang3.StringUtils) HoldingRequestBuilder(org.folio.rest.support.builders.HoldingRequestBuilder) DomainEventAssertions.assertRemoveAllEventForInstance(org.folio.rest.support.matchers.DomainEventAssertions.assertRemoveAllEventForInstance) JsonObject(io.vertx.core.json.JsonObject) DomainEventAssertions.assertNoEvent(org.folio.rest.support.matchers.DomainEventAssertions.assertNoEvent) Errors(org.folio.rest.jaxrs.model.Errors) HttpResponseMatchers.errorParametersValueIs(org.folio.rest.support.HttpResponseMatchers.errorParametersValueIs) Seconds.seconds(org.joda.time.Seconds.seconds) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ItemRequestBuilder(org.folio.rest.support.builders.ItemRequestBuilder) Set(java.util.Set) DomainEventAssertions.assertCreateEventForInstances(org.folio.rest.support.matchers.DomainEventAssertions.assertCreateEventForInstances) PostgresClient(org.folio.rest.persist.PostgresClient) JsonErrorResponse(org.folio.rest.support.JsonErrorResponse) IOUtils(org.apache.commons.io.IOUtils) Stream(java.util.stream.Stream) Logger(org.apache.logging.log4j.Logger) MarcJson(org.folio.rest.jaxrs.model.MarcJson) Publication(org.folio.rest.jaxrs.model.Publication) JsonObjectMatchers.hasSoleMessageContaining(org.folio.rest.support.JsonObjectMatchers.hasSoleMessageContaining) Async(io.vertx.ext.unit.Async) DateTimeMatchers.withinSecondsBeforeNow(org.folio.rest.support.matchers.DateTimeMatchers.withinSecondsBeforeNow) InterfaceUrls.instancesStorageBatchInstancesUrl(org.folio.rest.support.http.InterfaceUrls.instancesStorageBatchInstancesUrl) RunWith(org.junit.runner.RunWith) AdditionalHttpStatusCodes(org.folio.rest.support.AdditionalHttpStatusCodes) JsonObjectMatchers.identifierMatches(org.folio.rest.support.JsonObjectMatchers.identifierMatches) HTTP_OK(java.net.HttpURLConnection.HTTP_OK) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) DomainEventAssertions.assertRemoveEventForInstance(org.folio.rest.support.matchers.DomainEventAssertions.assertRemoveEventForInstance) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) Before(org.junit.Before) Matchers.greaterThanOrEqualTo(org.hamcrest.Matchers.greaterThanOrEqualTo) Vertx(io.vertx.core.Vertx) DomainEventAssertions.assertCreateEventForInstance(org.folio.rest.support.matchers.DomainEventAssertions.assertCreateEventForInstance) IOException(java.io.IOException) Test(org.junit.Test) ExecutionException(java.util.concurrent.ExecutionException) JsonArray(io.vertx.core.json.JsonArray) PgUtil(org.folio.rest.persist.PgUtil) InstancesBatchResponse(org.folio.rest.jaxrs.model.InstancesBatchResponse) IsNull.notNullValue(org.hamcrest.core.IsNull.notNullValue) DateTimeMatchers.hasIsoFormat(org.folio.rest.support.matchers.DateTimeMatchers.hasIsoFormat) Assert.assertEquals(org.junit.Assert.assertEquals) CoreMatchers.is(org.hamcrest.CoreMatchers.is) TestContext(io.vertx.ext.unit.TestContext) CoreMatchers.hasItem(org.hamcrest.CoreMatchers.hasItem) InterfaceUrls.holdingsStorageUrl(org.folio.rest.support.http.InterfaceUrls.holdingsStorageUrl) Response(org.folio.rest.support.Response) Matchers.either(org.hamcrest.Matchers.either) URL(java.net.URL) IsIterableContainingInAnyOrder.containsInAnyOrder(org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder) Instance(org.folio.rest.jaxrs.model.Instance) TimeoutException(java.util.concurrent.TimeoutException) InterfaceUrls.natureOfContentTermsUrl(org.folio.rest.support.http.InterfaceUrls.natureOfContentTermsUrl) OptimisticLocking(org.folio.rest.support.db.OptimisticLocking) DomainEventAssertions.assertUpdateEventForInstance(org.folio.rest.support.matchers.DomainEventAssertions.assertUpdateEventForInstance) JsonArrayHelper(org.folio.rest.support.JsonArrayHelper) InterfaceUrls.instancesStorageSyncUrl(org.folio.rest.support.http.InterfaceUrls.instancesStorageSyncUrl) After(org.junit.After) Assert.fail(org.junit.Assert.fail) Matchers.lessThanOrEqualTo(org.hamcrest.Matchers.lessThanOrEqualTo) UUID(java.util.UUID) ResponseHandler.text(org.folio.rest.support.ResponseHandler.text) Collectors(java.util.stream.Collectors) List(java.util.List) PostgresErrorMessageMatchers.isMaximumSequenceValueError(org.folio.rest.support.matchers.PostgresErrorMessageMatchers.isMaximumSequenceValueError) Optional(java.util.Optional) StringUtil.urlEncode(org.folio.util.StringUtil.urlEncode) Matchers.anyOf(org.hamcrest.Matchers.anyOf) UnsupportedEncodingException(java.io.UnsupportedEncodingException) InterfaceUrls.itemsStorageUrl(org.folio.rest.support.http.InterfaceUrls.itemsStorageUrl) HttpResponseMatchers.statusCodeIs(org.folio.rest.support.HttpResponseMatchers.statusCodeIs) CompletableFuture(java.util.concurrent.CompletableFuture) IndividualResource(org.folio.rest.support.IndividualResource) HashSet(java.util.HashSet) PostgresErrorMessageMatchers.isUniqueViolation(org.folio.rest.support.matchers.PostgresErrorMessageMatchers.isUniqueViolation) InterfaceUrls.instancesStorageUrl(org.folio.rest.support.http.InterfaceUrls.instancesStorageUrl) CoreMatchers.allOf(org.hamcrest.CoreMatchers.allOf) PublicationPeriod(org.folio.rest.jaxrs.model.PublicationPeriod) NatureOfContentTerm(org.folio.rest.jaxrs.model.NatureOfContentTerm) MalformedURLException(java.net.MalformedURLException) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) Matchers.both(org.hamcrest.Matchers.both) TimeUnit(java.util.concurrent.TimeUnit) HttpResponseMatchers.errorMessageContains(org.folio.rest.support.HttpResponseMatchers.errorMessageContains) HttpStatus(org.folio.HttpStatus) ResponseHandler.json(org.folio.rest.support.ResponseHandler.json) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) SECONDS(java.util.concurrent.TimeUnit.SECONDS) Async(io.vertx.ext.unit.Async) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString)

Example 5 with TENANT_ID

use of org.folio.rest.api.StorageTestSuite.TENANT_ID in project mod-inventory-storage by folio-org.

the class InstanceStorageTest method canPostSynchronousBatch.

@Test
public void canPostSynchronousBatch() throws Exception {
    JsonArray instancesArray = new JsonArray();
    int numberOfInstances = 1000;
    instancesArray.add(uprooted(UUID.randomUUID()));
    for (int i = 2; i < numberOfInstances; i++) {
        instancesArray.add(smallAngryPlanet(UUID.randomUUID()));
    }
    instancesArray.add(temeraire(UUID.randomUUID()));
    JsonObject instanceCollection = new JsonObject().put(INSTANCES_KEY, instancesArray);
    CompletableFuture<Response> createCompleted = new CompletableFuture<>();
    client.post(instancesStorageSyncUrl(""), instanceCollection, TENANT_ID, ResponseHandler.empty(createCompleted));
    assertThat(createCompleted.get(30, SECONDS), statusCodeIs(HttpStatus.HTTP_CREATED));
    JsonObject uprooted = instancesArray.getJsonObject(0);
    JsonObject smallAngryPlanet = instancesArray.getJsonObject(numberOfInstances / 2);
    JsonObject temeraire = instancesArray.getJsonObject(numberOfInstances - 1);
    assertExists(uprooted);
    assertExists(smallAngryPlanet);
    assertExists(temeraire);
    assertNotSuppressedFromDiscovery(instancesArray);
    final List<JsonObject> createdInstances = instancesArray.stream().map(obj -> (JsonObject) obj).map(json -> json.getString("id")).map(this::getById).map(Response::getJson).collect(Collectors.toList());
    assertCreateEventForInstances(createdInstances);
}
Also used : JsonArray(io.vertx.core.json.JsonArray) JsonErrorResponse(org.folio.rest.support.JsonErrorResponse) InstancesBatchResponse(org.folio.rest.jaxrs.model.InstancesBatchResponse) Response(org.folio.rest.support.Response) HttpURLConnection(java.net.HttpURLConnection) ResponseHandler(org.folio.rest.support.ResponseHandler) Arrays(java.util.Arrays) TENANT_ID(org.folio.rest.api.StorageTestSuite.TENANT_ID) Matchers.not(org.hamcrest.Matchers.not) StringUtils(org.apache.commons.lang3.StringUtils) HoldingRequestBuilder(org.folio.rest.support.builders.HoldingRequestBuilder) DomainEventAssertions.assertRemoveAllEventForInstance(org.folio.rest.support.matchers.DomainEventAssertions.assertRemoveAllEventForInstance) JsonObject(io.vertx.core.json.JsonObject) DomainEventAssertions.assertNoEvent(org.folio.rest.support.matchers.DomainEventAssertions.assertNoEvent) Errors(org.folio.rest.jaxrs.model.Errors) HttpResponseMatchers.errorParametersValueIs(org.folio.rest.support.HttpResponseMatchers.errorParametersValueIs) Seconds.seconds(org.joda.time.Seconds.seconds) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ItemRequestBuilder(org.folio.rest.support.builders.ItemRequestBuilder) Set(java.util.Set) DomainEventAssertions.assertCreateEventForInstances(org.folio.rest.support.matchers.DomainEventAssertions.assertCreateEventForInstances) PostgresClient(org.folio.rest.persist.PostgresClient) JsonErrorResponse(org.folio.rest.support.JsonErrorResponse) IOUtils(org.apache.commons.io.IOUtils) Stream(java.util.stream.Stream) Logger(org.apache.logging.log4j.Logger) MarcJson(org.folio.rest.jaxrs.model.MarcJson) Publication(org.folio.rest.jaxrs.model.Publication) JsonObjectMatchers.hasSoleMessageContaining(org.folio.rest.support.JsonObjectMatchers.hasSoleMessageContaining) Async(io.vertx.ext.unit.Async) DateTimeMatchers.withinSecondsBeforeNow(org.folio.rest.support.matchers.DateTimeMatchers.withinSecondsBeforeNow) InterfaceUrls.instancesStorageBatchInstancesUrl(org.folio.rest.support.http.InterfaceUrls.instancesStorageBatchInstancesUrl) RunWith(org.junit.runner.RunWith) AdditionalHttpStatusCodes(org.folio.rest.support.AdditionalHttpStatusCodes) JsonObjectMatchers.identifierMatches(org.folio.rest.support.JsonObjectMatchers.identifierMatches) HTTP_OK(java.net.HttpURLConnection.HTTP_OK) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) DomainEventAssertions.assertRemoveEventForInstance(org.folio.rest.support.matchers.DomainEventAssertions.assertRemoveEventForInstance) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) Before(org.junit.Before) Matchers.greaterThanOrEqualTo(org.hamcrest.Matchers.greaterThanOrEqualTo) Vertx(io.vertx.core.Vertx) DomainEventAssertions.assertCreateEventForInstance(org.folio.rest.support.matchers.DomainEventAssertions.assertCreateEventForInstance) IOException(java.io.IOException) Test(org.junit.Test) ExecutionException(java.util.concurrent.ExecutionException) JsonArray(io.vertx.core.json.JsonArray) PgUtil(org.folio.rest.persist.PgUtil) InstancesBatchResponse(org.folio.rest.jaxrs.model.InstancesBatchResponse) IsNull.notNullValue(org.hamcrest.core.IsNull.notNullValue) DateTimeMatchers.hasIsoFormat(org.folio.rest.support.matchers.DateTimeMatchers.hasIsoFormat) Assert.assertEquals(org.junit.Assert.assertEquals) CoreMatchers.is(org.hamcrest.CoreMatchers.is) TestContext(io.vertx.ext.unit.TestContext) CoreMatchers.hasItem(org.hamcrest.CoreMatchers.hasItem) InterfaceUrls.holdingsStorageUrl(org.folio.rest.support.http.InterfaceUrls.holdingsStorageUrl) Response(org.folio.rest.support.Response) Matchers.either(org.hamcrest.Matchers.either) URL(java.net.URL) IsIterableContainingInAnyOrder.containsInAnyOrder(org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder) Instance(org.folio.rest.jaxrs.model.Instance) TimeoutException(java.util.concurrent.TimeoutException) InterfaceUrls.natureOfContentTermsUrl(org.folio.rest.support.http.InterfaceUrls.natureOfContentTermsUrl) OptimisticLocking(org.folio.rest.support.db.OptimisticLocking) DomainEventAssertions.assertUpdateEventForInstance(org.folio.rest.support.matchers.DomainEventAssertions.assertUpdateEventForInstance) JsonArrayHelper(org.folio.rest.support.JsonArrayHelper) InterfaceUrls.instancesStorageSyncUrl(org.folio.rest.support.http.InterfaceUrls.instancesStorageSyncUrl) After(org.junit.After) Assert.fail(org.junit.Assert.fail) Matchers.lessThanOrEqualTo(org.hamcrest.Matchers.lessThanOrEqualTo) UUID(java.util.UUID) ResponseHandler.text(org.folio.rest.support.ResponseHandler.text) Collectors(java.util.stream.Collectors) List(java.util.List) PostgresErrorMessageMatchers.isMaximumSequenceValueError(org.folio.rest.support.matchers.PostgresErrorMessageMatchers.isMaximumSequenceValueError) Optional(java.util.Optional) StringUtil.urlEncode(org.folio.util.StringUtil.urlEncode) Matchers.anyOf(org.hamcrest.Matchers.anyOf) UnsupportedEncodingException(java.io.UnsupportedEncodingException) InterfaceUrls.itemsStorageUrl(org.folio.rest.support.http.InterfaceUrls.itemsStorageUrl) HttpResponseMatchers.statusCodeIs(org.folio.rest.support.HttpResponseMatchers.statusCodeIs) CompletableFuture(java.util.concurrent.CompletableFuture) IndividualResource(org.folio.rest.support.IndividualResource) HashSet(java.util.HashSet) PostgresErrorMessageMatchers.isUniqueViolation(org.folio.rest.support.matchers.PostgresErrorMessageMatchers.isUniqueViolation) InterfaceUrls.instancesStorageUrl(org.folio.rest.support.http.InterfaceUrls.instancesStorageUrl) CoreMatchers.allOf(org.hamcrest.CoreMatchers.allOf) PublicationPeriod(org.folio.rest.jaxrs.model.PublicationPeriod) NatureOfContentTerm(org.folio.rest.jaxrs.model.NatureOfContentTerm) MalformedURLException(java.net.MalformedURLException) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) Matchers.both(org.hamcrest.Matchers.both) TimeUnit(java.util.concurrent.TimeUnit) HttpResponseMatchers.errorMessageContains(org.folio.rest.support.HttpResponseMatchers.errorMessageContains) HttpStatus(org.folio.HttpStatus) ResponseHandler.json(org.folio.rest.support.ResponseHandler.json) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) SECONDS(java.util.concurrent.TimeUnit.SECONDS) CompletableFuture(java.util.concurrent.CompletableFuture) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Aggregations

UUID (java.util.UUID)17 CompletableFuture (java.util.concurrent.CompletableFuture)17 ExecutionException (java.util.concurrent.ExecutionException)17 TimeoutException (java.util.concurrent.TimeoutException)17 TENANT_ID (org.folio.rest.api.StorageTestSuite.TENANT_ID)17 Before (org.junit.Before)17 Test (org.junit.Test)17 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)16 RunWith (org.junit.runner.RunWith)16 PostgresClient (org.folio.rest.persist.PostgresClient)15 Response (org.folio.rest.support.Response)15 CoreMatchers.is (org.hamcrest.CoreMatchers.is)15 LogManager (org.apache.logging.log4j.LogManager)14 Logger (org.apache.logging.log4j.Logger)14 VertxUnitRunner (io.vertx.ext.unit.junit.VertxUnitRunner)12 IsNull.notNullValue (org.hamcrest.core.IsNull.notNullValue)12 Vertx (io.vertx.core.Vertx)11 JsonObject (io.vertx.core.json.JsonObject)11 List (java.util.List)11 TimeUnit (java.util.concurrent.TimeUnit)11