Search in sources :

Example 6 with StringValuePattern

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();
}
Also used : StringValuePattern(com.github.tomakehurst.wiremock.matching.StringValuePattern)

Example 7 with StringValuePattern

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);
}
Also used : ListStubMappingsResult(com.github.tomakehurst.wiremock.admin.model.ListStubMappingsResult) StringValuePattern(com.github.tomakehurst.wiremock.matching.StringValuePattern)

Example 8 with StringValuePattern

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);
}
Also used : Zulip(com.github.jamesnetherton.zulip.client.Zulip) CountDownLatch(java.util.concurrent.CountDownLatch) StringValuePattern(com.github.tomakehurst.wiremock.matching.StringValuePattern) Test(org.junit.jupiter.api.Test)

Example 9 with StringValuePattern

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)));
}
Also used : ResponseDefinitionBuilder(com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern) EqualToPattern(com.github.tomakehurst.wiremock.matching.EqualToPattern) StringValuePattern(com.github.tomakehurst.wiremock.matching.StringValuePattern)

Aggregations

StringValuePattern (com.github.tomakehurst.wiremock.matching.StringValuePattern)9 ResponseDefinitionBuilder (com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder)3 EqualToPattern (com.github.tomakehurst.wiremock.matching.EqualToPattern)3 UrlPathPattern (com.github.tomakehurst.wiremock.matching.UrlPathPattern)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Zulip (com.github.jamesnetherton.zulip.client.Zulip)1 ListStubMappingsResult (com.github.tomakehurst.wiremock.admin.model.ListStubMappingsResult)1 WireMock (com.github.tomakehurst.wiremock.client.WireMock)1 Parameters (com.github.tomakehurst.wiremock.extension.Parameters)1 RequestMethod (com.github.tomakehurst.wiremock.http.RequestMethod)1 ContentPattern (com.github.tomakehurst.wiremock.matching.ContentPattern)1 RequestPattern (com.github.tomakehurst.wiremock.matching.RequestPattern)1 RequestPatternBuilder (com.github.tomakehurst.wiremock.matching.RequestPatternBuilder)1 UrlPattern (com.github.tomakehurst.wiremock.matching.UrlPattern)1 FindServeEventsResult (com.github.tomakehurst.wiremock.verification.FindServeEventsResult)1 GString (groovy.lang.GString)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1