use of com.github.tomakehurst.wiremock.matching.StringValuePattern in project wiremock by wiremock.
the class RemoveStubMappingsByMetadataTask method execute.
@Override
public ResponseDefinition execute(Admin admin, Request request, PathParams pathParams) {
StringValuePattern pattern = Json.read(request.getBodyAsString(), StringValuePattern.class);
admin.removeStubsByMetadata(pattern);
return ResponseDefinition.okEmptyJson();
}
use of com.github.tomakehurst.wiremock.matching.StringValuePattern in project wiremock by wiremock.
the class FindStubMappingsByMetadataTask method execute.
@Override
public ResponseDefinition execute(Admin admin, Request request, PathParams pathParams) {
StringValuePattern pattern = Json.read(request.getBodyAsString(), StringValuePattern.class);
ListStubMappingsResult stubMappings = admin.findAllStubsByMetadata(pattern);
return ResponseDefinition.okForJson(stubMappings);
}
use of com.github.tomakehurst.wiremock.matching.StringValuePattern in project zulip-java-client by jamesnetherton.
the class CustomZulipHttpClientTest method customHttpClientFactory.
@Test
public void customHttpClientFactory() throws Exception {
CountDownLatch latch = new CountDownLatch(1);
Zulip customZulip = new Zulip.Builder().email("test@test.com").apiKey("test-key").site("http://localhost:" + server.port()).httpClientFactory(new ZulipJdkHttpClientFactory(latch)).build();
Map<String, StringValuePattern> params = QueryParams.create().add(GetApiKeyApiRequest.USERNAME, "test@test.com").add(GetApiKeyApiRequest.PASSWORD, "test").get();
stubZulipResponse(POST, "/fetch_api_key", params, "/com/github/jamesnetherton/zulip/client/api/server/getApiKey.json");
String key = customZulip.server().getApiKey("test@test.com", "test").execute();
assertTrue(latch.await(1, TimeUnit.SECONDS));
assertEquals("abc123zxy", key);
}
use of com.github.tomakehurst.wiremock.matching.StringValuePattern 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)));
}
Aggregations