Search in sources :

Example 1 with RetryStatus

use of org.folio.repository.holdings.status.retry.RetryStatus in project mod-kb-ebsco-java by folio-org.

the class EholdingsKbCredentialsImplTest method shouldReturnStatusNotStartedOnKbCredentialsCreation.

@Test
public void shouldReturnStatusNotStartedOnKbCredentialsCreation() {
    KbCredentialsPostRequest kbCredentialsPostRequest = new KbCredentialsPostRequest().withData(stubbedCredentials());
    String postBody = Json.encode(kbCredentialsPostRequest);
    mockVerifyValidCredentialsRequest();
    KbCredentials actual = postWithStatus(KB_CREDENTIALS_ENDPOINT, postBody, SC_CREATED, STUB_TOKEN_HEADER).as(KbCredentials.class);
    final HoldingsLoadingStatus status = getStatus(actual.getId(), vertx);
    assertEquals(LoadStatusNameEnum.NOT_STARTED, status.getData().getAttributes().getStatus().getName());
    final RetryStatus retryStatus = getRetryStatus(actual.getId(), vertx);
    assertThat(retryStatus, notNullValue());
}
Also used : KbCredentialsTestUtil.saveKbCredentials(org.folio.util.KbCredentialsTestUtil.saveKbCredentials) KbCredentialsTestUtil.getKbCredentials(org.folio.util.KbCredentialsTestUtil.getKbCredentials) KbCredentials(org.folio.rest.jaxrs.model.KbCredentials) HoldingsLoadingStatus(org.folio.rest.jaxrs.model.HoldingsLoadingStatus) Matchers.containsString(org.hamcrest.Matchers.containsString) RetryStatus(org.folio.repository.holdings.status.retry.RetryStatus) HoldingsRetryStatusTestUtil.getRetryStatus(org.folio.util.HoldingsRetryStatusTestUtil.getRetryStatus) KbCredentialsPostRequest(org.folio.rest.jaxrs.model.KbCredentialsPostRequest) Test(org.junit.Test)

Example 2 with RetryStatus

use of org.folio.repository.holdings.status.retry.RetryStatus in project mod-kb-ebsco-java by folio-org.

the class HoldingsRetryStatusTestUtil method getRetryStatus.

public static RetryStatus getRetryStatus(String credentialsId, Vertx vertx) {
    CompletableFuture<RetryStatus> future = new CompletableFuture<>();
    String query = prepareQuery(getRetryStatusByCredentials(), holdingsStatusAuditTestTable());
    Tuple params = Tuple.of(toUUID(credentialsId));
    PostgresClient.getInstance(vertx, STUB_TENANT).select(query, params, event -> future.complete(mapFirstItem(event.result(), HoldingsRetryStatusTestUtil::parseRetryStatus)));
    return future.join();
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) RetryStatus(org.folio.repository.holdings.status.retry.RetryStatus) Tuple(io.vertx.sqlclient.Tuple)

Example 3 with RetryStatus

use of org.folio.repository.holdings.status.retry.RetryStatus in project mod-kb-ebsco-java by folio-org.

the class HoldingsRetryStatusTestUtil method insertRetryStatus.

public static RetryStatus insertRetryStatus(String credentialsId, Vertx vertx) {
    CompletableFuture<RetryStatus> future = new CompletableFuture<>();
    String query = prepareQuery(insertQuery(ID_COLUMN, CREDENTIALS_ID_COLUMN, ATTEMPTS_LEFT_COLUMN, TIMER_ID_COLUMN), holdingsStatusAuditTestTable());
    Tuple params = Tuple.of(UUID.randomUUID(), toUUID(credentialsId), 2, null);
    PostgresClient.getInstance(vertx, STUB_TENANT).execute(query, params, event -> future.complete(null));
    return future.join();
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) RetryStatus(org.folio.repository.holdings.status.retry.RetryStatus) Tuple(io.vertx.sqlclient.Tuple)

Aggregations

RetryStatus (org.folio.repository.holdings.status.retry.RetryStatus)3 Tuple (io.vertx.sqlclient.Tuple)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 HoldingsLoadingStatus (org.folio.rest.jaxrs.model.HoldingsLoadingStatus)1 KbCredentials (org.folio.rest.jaxrs.model.KbCredentials)1 KbCredentialsPostRequest (org.folio.rest.jaxrs.model.KbCredentialsPostRequest)1 HoldingsRetryStatusTestUtil.getRetryStatus (org.folio.util.HoldingsRetryStatusTestUtil.getRetryStatus)1 KbCredentialsTestUtil.getKbCredentials (org.folio.util.KbCredentialsTestUtil.getKbCredentials)1 KbCredentialsTestUtil.saveKbCredentials (org.folio.util.KbCredentialsTestUtil.saveKbCredentials)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.Test)1