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());
}
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();
}
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();
}
Aggregations