Skip to content

Commit

Permalink
#4682 PlanB State Store
Browse files Browse the repository at this point in the history
  • Loading branch information
stroomdev66 committed Jan 15, 2025
1 parent 82dfee3 commit 6d348f9
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

import com.github.tomakehurst.wiremock.client.MappingBuilder;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.core.Admin;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import com.github.tomakehurst.wiremock.extension.PostServeAction;
import com.github.tomakehurst.wiremock.extension.Parameters;
import com.github.tomakehurst.wiremock.extension.ServeEventListener;
import com.github.tomakehurst.wiremock.http.HttpHeaders;
import com.github.tomakehurst.wiremock.http.LoggedResponse;
import com.github.tomakehurst.wiremock.http.MultiValue;
Expand Down Expand Up @@ -77,20 +77,23 @@ public class MockHttpDestination {
WireMockExtension createExtension() {
return WireMockExtension.newInstance()
.options(WireMockConfiguration.wireMockConfig().port(DEFAULT_STROOM_PORT))
.options(WireMockConfiguration.wireMockConfig().extensions(new PostServeAction() {
.options(WireMockConfiguration.wireMockConfig().extensions(new ServeEventListener() {
@Override
public String getName() {
return "Request logging action";
}

@Override
public void doGlobalAction(final ServeEvent serveEvent, final Admin admin) {
super.doGlobalAction(serveEvent, admin);
if (isRequestLoggingEnabled) {
dumpWireMockEvent(serveEvent);
}
if (serveEvent.getRequest().getUrl().equals(getDataFeedPath())) {
captureDataFeedRequest(serveEvent);
public void afterComplete(final ServeEvent serveEvent, final Parameters parameters) {
if (serveEvent.getResponse().getStatus() == 200) {
if (isRequestLoggingEnabled) {
dumpWireMockEvent(serveEvent);
}
if (serveEvent.getRequest().getUrl().equals(getDataFeedPath())) {
captureDataFeedRequest(serveEvent);
}
} else {
LOGGER.error(serveEvent.toString());
}
}
}))
Expand Down

0 comments on commit 6d348f9

Please sign in to comment.