Skip to content

Commit

Permalink
undo
Browse files Browse the repository at this point in the history
  • Loading branch information
codingPF committed Nov 16, 2023
1 parent 1913d72 commit 74ae034
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class WireMockTestBase {
private boolean wireMockStarted = false;

@Before
public synchronized void setUpClass() {
public void setUpClass() {
LOG.info("Setting up WireMock test class");
startWireMock();
}
Expand Down Expand Up @@ -73,7 +73,7 @@ protected Queue<CrawlerUrlDTO> createCrawlerUrlDto(final String requestUrl) {
return input;
}

protected synchronized void setupSuccessfulJsonResponse(final String requestUrl, final String aResponseFile) {
protected void setupSuccessfulJsonResponse(final String requestUrl, final String aResponseFile) {
final String jsonBody = FileReader.readFile(aResponseFile, getWireMockHostPort());
LOG.info("Adding successful JSON response stub for {}", requestUrl);
wireMockServer.stubFor(
Expand All @@ -95,7 +95,7 @@ protected void setupSuccessfulJsonPostResponse(
setupSuccessfulJsonPostResponse(requestUrl, aResponseFile, null);
}

protected synchronized void setupSuccessfulJsonPostResponse(
protected void setupSuccessfulJsonPostResponse(
final String requestUrl, final String aResponseFile, @Nullable final Integer status) {
final String jsonBody = FileReader.readFile(aResponseFile, getWireMockHostPort());
LOG.info("Adding successful JSON post response stub for {}", requestUrl);
Expand All @@ -108,7 +108,7 @@ protected synchronized void setupSuccessfulJsonPostResponse(
.withBody(jsonBody)));
}

protected synchronized void setupSuccessfulJsonPostResponse(
protected void setupSuccessfulJsonPostResponse(
final String requestUrl, final String responsefile, final String requestBodyPart, @Nullable final Integer status) {
final String jsonBody = FileReader.readFile(responsefile);
wireMockServer.stubFor(
Expand All @@ -121,7 +121,7 @@ protected synchronized void setupSuccessfulJsonPostResponse(
.withBody(jsonBody)));
}

protected synchronized void setupSuccessfulXmlResponse(final String requestUrl, final String aResponseFile) {
protected void setupSuccessfulXmlResponse(final String requestUrl, final String aResponseFile) {
final String xmlBody = FileReader.readFile(aResponseFile, getWireMockHostPort());
LOG.info("Adding successful XML response stub for {}", requestUrl);
wireMockServer.stubFor(
Expand All @@ -133,31 +133,31 @@ protected synchronized void setupSuccessfulXmlResponse(final String requestUrl,
.withBody(xmlBody)));
}

protected synchronized void setupSuccessfulResponse(final String requestUrl, final String aResponseFile) {
protected void setupSuccessfulResponse(final String requestUrl, final String aResponseFile) {
final String body = FileReader.readFile(aResponseFile, getWireMockHostPort());
LOG.info("Adding successful response stub for {}", requestUrl);
wireMockServer.stubFor(
get(urlEqualTo(requestUrl)).willReturn(aResponse().withStatus(200).withBody(body)));
}

protected synchronized void setupHeadResponse(final String requestUrl, final int aHttpCode) {
protected void setupHeadResponse(final String requestUrl, final int aHttpCode) {
LOG.info("Adding successful HEAD response stub for {}", requestUrl);
wireMockServer.stubFor(
head(urlEqualTo(requestUrl)).willReturn(aResponse().withStatus(aHttpCode)));
}

protected synchronized void setupHeadResponse(final int aHttpCode) {
protected void setupHeadResponse(final int aHttpCode) {
LOG.info("Adding {} HEAD response stub for any URL.", aHttpCode);
wireMockServer.stubFor(head(anyUrl()).willReturn(aResponse().withStatus(aHttpCode)));
}

protected synchronized void setupResponseWithoutBody(final String requestUrl, final int aHttpCode) {
protected void setupResponseWithoutBody(final String requestUrl, final int aHttpCode) {
LOG.info("Adding {} stub for {}.", aHttpCode, requestUrl);
wireMockServer.stubFor(
get(urlEqualTo(requestUrl)).willReturn(aResponse().withStatus(aHttpCode)));
}

protected synchronized void setupHeadRequestForFileSize() {
protected void setupHeadRequestForFileSize() {
LOG.info("Adding file size HEAD request stub for any url.");
wireMockServer.stubFor(
head(urlMatching(".*"))
Expand Down

0 comments on commit 74ae034

Please sign in to comment.