use of com.github.tomakehurst.wiremock.matching.UrlPathPattern in project mod-kb-ebsco-java by folio-org.
the class DefaultLoadHoldingsImplTest method mockPostHoldings.
private void mockPostHoldings() {
StringValuePattern urlPattern = new EqualToPattern(RMAPI_POST_HOLDINGS_URL);
stubFor(post(new UrlPathPattern(urlPattern, false)).willReturn(new ResponseDefinitionBuilder().withBody("").withStatus(202)));
}
use of com.github.tomakehurst.wiremock.matching.UrlPathPattern 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());
}
use of com.github.tomakehurst.wiremock.matching.UrlPathPattern in project mod-inventory by folio-org.
the class JobProfileSnapshotCacheTest method shouldReturnFailedFutureWhenGetServerErrorOnSnapshotLoading.
@Test
public void shouldReturnFailedFutureWhenGetServerErrorOnSnapshotLoading(TestContext context) {
Async async = context.async();
WireMock.stubFor(get(new UrlPathPattern(new RegexPattern(PROFILE_SNAPSHOT_URL + "/.*"), true)).willReturn(WireMock.serverError()));
Future<Optional<ProfileSnapshotWrapper>> optionalFuture = profileSnapshotCache.get(jobProfileSnapshot.getId(), this.context);
optionalFuture.onComplete(ar -> {
context.assertTrue(ar.failed());
async.complete();
});
}
use of com.github.tomakehurst.wiremock.matching.UrlPathPattern in project mod-inventory by folio-org.
the class JobProfileSnapshotCacheTest method setUp.
@Before
public void setUp() {
WireMock.stubFor(get(new UrlPathPattern(new RegexPattern(PROFILE_SNAPSHOT_URL + "/.*"), true)).willReturn(WireMock.ok().withBody(Json.encode(jobProfileSnapshot))));
context = EventHandlingUtil.constructContext(TENANT_ID, "token", mockServer.baseUrl());
}
use of com.github.tomakehurst.wiremock.matching.UrlPathPattern in project mod-inventory by folio-org.
the class JobProfileSnapshotCacheTest method shouldReturnEmptyOptionalWhenGetNotFoundOnSnapshotLoading.
@Test
public void shouldReturnEmptyOptionalWhenGetNotFoundOnSnapshotLoading(TestContext context) {
Async async = context.async();
WireMock.stubFor(get(new UrlPathPattern(new RegexPattern(PROFILE_SNAPSHOT_URL + "/.*"), true)).willReturn(WireMock.notFound()));
Future<Optional<ProfileSnapshotWrapper>> optionalFuture = profileSnapshotCache.get(jobProfileSnapshot.getId(), this.context);
optionalFuture.onComplete(ar -> {
context.assertTrue(ar.succeeded());
context.assertTrue(ar.result().isEmpty());
async.complete();
});
}
Aggregations