use of org.folio.service.holdings.HoldingConstants.CREATE_SNAPSHOT_ACTION in project mod-kb-ebsco-java by folio-org.
the class LoadHoldingsStatusImplTest method shouldReturnStatusPopulatingStagingArea.
@Test
public void shouldReturnStatusPopulatingStagingArea(TestContext context) throws IOException, URISyntaxException {
setupDefaultLoadKBConfiguration();
mockResponseList(new UrlPathPattern(new EqualToPattern(RMAPI_HOLDINGS_STATUS_URL), false), new ResponseDefinitionBuilder().withBody(readFile("responses/rmapi/holdings/status/get-status-in-progress.json")).withStatus(200), new ResponseDefinitionBuilder().withBody(readFile("responses/rmapi/holdings/status/get-status-completed.json")).withStatus(200));
Async startedAsync = context.async();
Handler<DeliveryContext<LoadHoldingsMessage>> interceptor = interceptAndContinue(LOAD_FACADE_ADDRESS, CREATE_SNAPSHOT_ACTION, message -> startedAsync.complete());
vertx.eventBus().addOutboundInterceptor(interceptor);
interceptors.add(interceptor);
Async finishedAsync = context.async();
interceptor = interceptAndStop(HOLDINGS_SERVICE_ADDRESS, SNAPSHOT_CREATED_ACTION, message -> finishedAsync.complete());
vertx.eventBus().addOutboundInterceptor(interceptor);
interceptors.add(interceptor);
postWithStatus(HOLDINGS_LOAD_BY_ID_URL, "", SC_NO_CONTENT, STUB_TOKEN_HEADER);
startedAsync.await(TIMEOUT);
final HoldingsLoadingStatus status = getWithOk(STUB_HOLDINGS_LOAD_STATUS_BY_ID_URL, STUB_TOKEN_HEADER).body().as(HoldingsLoadingStatus.class);
assertThat(status.getData().getAttributes().getStatus().getDetail(), equalTo(LoadStatusNameDetailEnum.POPULATING_STAGING_AREA));
finishedAsync.await(TIMEOUT);
}
use of org.folio.service.holdings.HoldingConstants.CREATE_SNAPSHOT_ACTION in project mod-kb-ebsco-java by folio-org.
the class DefaultLoadHoldingsImplTest method shouldStartLoadingWhenStatusInProgressAndProcessTimedOut.
@Test
public void shouldStartLoadingWhenStatusInProgressAndProcessTimedOut() {
setupDefaultLoadKBConfiguration();
HoldingsLoadingStatus status = getStatusLoadingHoldings(1000, 500, 10, 5);
status.getData().getAttributes().setUpdated(POSTGRES_TIMESTAMP_FORMATTER.format(OffsetDateTime.now().minus(10, ChronoUnit.DAYS)));
saveStatus(STUB_CREDENTIALS_ID, status, PROCESS_ID, vertx);
interceptor = interceptAndStop(LOAD_FACADE_ADDRESS, CREATE_SNAPSHOT_ACTION, message -> {
});
vertx.eventBus().addOutboundInterceptor(interceptor);
postWithStatus(HOLDINGS_LOAD_BY_ID_URL, "", SC_NO_CONTENT, STUB_TOKEN_HEADER);
}
Aggregations