use of org.folio.test.util.TestUtil.STUB_TENANT in project mod-kb-ebsco-java by folio-org.
the class DefaultLoadHoldingsImplTest method shouldSendSaveHoldingsEventForEachLoadedPage.
@Test
public void shouldSendSaveHoldingsEventForEachLoadedPage(TestContext context) throws IOException, URISyntaxException {
mockGet(new EqualToPattern(RMAPI_HOLDINGS_STATUS_URL), RMAPI_RESPONSE_HOLDINGS_STATUS_COMPLETED);
mockGet(new RegexPattern(RMAPI_POST_HOLDINGS_URL), RMAPI_RESPONSE_HOLDINGS);
List<HoldingsMessage> messages = new ArrayList<>();
Async async = context.async(EXPECTED_LOADED_PAGES);
interceptor = interceptAndStop(HOLDINGS_SERVICE_ADDRESS, SAVE_HOLDINGS_ACTION, message -> {
messages.add(((JsonObject) message.body()).getJsonObject("holdings").mapTo(HoldingsMessage.class));
async.countDown();
});
vertx.eventBus().addOutboundInterceptor(interceptor);
LoadServiceFacade proxy = LoadServiceFacade.createProxy(vertx, LOAD_FACADE_ADDRESS);
proxy.loadHoldings(new LoadHoldingsMessage(stubConfiguration, STUB_CREDENTIALS_ID, STUB_TENANT, 5001, 2, null, null));
async.await(TIMEOUT);
assertEquals(2, messages.size());
assertEquals(STUB_HOLDINGS_TITLE, messages.get(0).getHoldingList().get(0).getPublicationTitle());
}
use of org.folio.test.util.TestUtil.STUB_TENANT in project mod-kb-ebsco-java by folio-org.
the class DefaultLoadServiceFacadeTest method shouldCreateSnapshotOnInitialStatusNone.
@Test
public void shouldCreateSnapshotOnInitialStatusNone(TestContext context) throws IOException, URISyntaxException {
Async async = context.async();
mockResponseList(new UrlPathPattern(new EqualToPattern(RMAPI_HOLDINGS_STATUS_URL), false), new ResponseDefinitionBuilder().withBody(readFile("responses/rmapi/holdings/status/get-status-none.json")), new ResponseDefinitionBuilder().withBody(readFile("responses/rmapi/holdings/status/get-status-completed.json")));
mockPostHoldings();
interceptor = interceptAndStop(HOLDINGS_SERVICE_ADDRESS, SNAPSHOT_CREATED_ACTION, message -> async.complete());
vertx.eventBus().addOutboundInterceptor(interceptor);
loadServiceFacade.createSnapshot(new ConfigurationMessage(configuration, STUB_CREDENTIALS_ID, STUB_TENANT));
async.await(TIMEOUT);
assertTrue(async.isSucceeded());
}
Aggregations