From cec5d29f1c345a4257f833e6c185a27cf677f4e3 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Wed, 14 Jun 2017 14:16:26 +0200 Subject: [PATCH] Less noise from WireMockHttpServerStub; fixes #329 --- .../wiremock/WireMockHttpServerStub.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/WireMockHttpServerStub.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/WireMockHttpServerStub.java index 889713b19b..28c0c06046 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/WireMockHttpServerStub.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/WireMockHttpServerStub.java @@ -1,5 +1,12 @@ package org.springframework.cloud.contract.stubrunner.provider.wiremock; +import com.github.jknack.handlebars.Helper; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; +import com.github.tomakehurst.wiremock.stubbing.StubMapping; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -18,13 +25,6 @@ import org.springframework.util.ClassUtils; import org.springframework.util.SocketUtils; import org.springframework.util.StreamUtils; -import com.github.jknack.handlebars.Helper; -import com.github.tomakehurst.wiremock.WireMockServer; -import com.github.tomakehurst.wiremock.client.WireMock; -import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; -import com.github.tomakehurst.wiremock.stubbing.StubMapping; - /** * Abstraction over WireMock as a HTTP Server Stub * @@ -73,7 +73,9 @@ public class WireMockHttpServerStub implements HttpServerStub { @Override public HttpServerStub start() { if (isRunning()) { - log.info("The server is already running at port [" + port() + "]"); + if (log.isDebugEnabled()) { + log.info("The server is already running at port [" + port() + "]"); + } return this; } return start(SocketUtils.findAvailableTcpPort()); @@ -89,7 +91,9 @@ public class WireMockHttpServerStub implements HttpServerStub { @Override public HttpServerStub stop() { if (!isRunning()) { - log.warn("Trying to stop a non started server!"); + if (log.isDebugEnabled()) { + log.warn("Trying to stop a non started server!"); + } return this; } this.wireMockServer.stop();