com.github.tomakehurst.wiremock.common.Notifier Java Examples
The following examples show how to use
com.github.tomakehurst.wiremock.common.Notifier.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Webhooks.java From wiremock-webhooks-extension with Apache License 2.0 | 5 votes |
@Override public void doAction(final ServeEvent serveEvent, final Admin admin, final Parameters parameters) { final Notifier notifier = notifier(); scheduler.schedule( new Runnable() { @Override public void run() { WebhookDefinition definition = parameters.as(WebhookDefinition.class); for (WebhookTransformer transformer: transformers) { definition = transformer.transform(serveEvent, definition); } HttpUriRequest request = buildRequest(definition); try { HttpResponse response = httpClient.execute(request); notifier.info( String.format("Webhook %s request to %s returned status %s\n\n%s", definition.getMethod(), definition.getUrl(), response.getStatusLine(), EntityUtils.toString(response.getEntity()) ) ); } catch (IOException e) { throwUnchecked(e); } } }, 0L, SECONDS ); }