use of com.github.tomakehurst.wiremock.common.Slf4jNotifier in project spring-cloud-contract by spring-cloud.
the class PortAndMappings method start.
@Override
public HttpServerStub start(HttpServerStubConfiguration configuration) {
if (isRunning()) {
if (log.isTraceEnabled()) {
log.trace("The server is already running at port [" + port() + "]");
}
return this;
}
int port = configuration.port;
WireMockConfiguration wireMockConfiguration = config().port(port).notifier(new Slf4jNotifier(true));
if (configuration.configurer.isAccepted(wireMockConfiguration)) {
@SuppressWarnings("unchecked") HttpServerStubConfigurer<WireMockConfiguration> configurer = configuration.configurer;
wireMockConfiguration = configurer.configure(wireMockConfiguration, configuration);
}
this.wireMockConfiguration = wireMockConfiguration;
this.https = wireMockConfiguration.httpsSettings().enabled();
port = this.https ? wireMockConfiguration.httpsSettings().port() : wireMockConfiguration.portNumber();
this.wireMockServer = new WireMockServer(wireMockConfiguration);
this.wireMockServer.start();
if (log.isDebugEnabled()) {
log.debug("For " + configuration.toColonSeparatedDependencyNotation() + " Started WireMock at [" + (this.https ? "https" : "http") + "] port [" + port + "]");
}
cacheStubServer(configuration.randomPort, port);
return this;
}
use of com.github.tomakehurst.wiremock.common.Slf4jNotifier in project sugoi-api by InseeFr.
the class WebhookReceiverService method startServer.
public static boolean startServer() {
WireMockServer webhookServer = new WireMockServer(WireMockConfiguration.wireMockConfig().port(8089).notifier(new Slf4jNotifier(true)).threadPoolFactory(new ThreadPoolFactory() {
@Override
public ThreadPool buildThreadPool(Options options) {
ThreadPool tp = new QueuedDaemonThreadPool(options.containerThreads());
return tp;
}
}));
webhookServer.start();
webhookServer.stubFor(post("/spoc/send").willReturn(aResponse().withStatus(200)));
return true;
}
use of com.github.tomakehurst.wiremock.common.Slf4jNotifier in project cf-ops-automation-broker by orange-cloudfoundry.
the class WireMockTestFixture method startWireMock.
@PostConstruct
void startWireMock() {
wireMockServer = new WireMockServer(options().port(8088).httpsPort(8089).notifier(new Slf4jNotifier(true)));
wireMockServer.start();
}
use of com.github.tomakehurst.wiremock.common.Slf4jNotifier in project cf-ops-automation-broker by orange-cloudfoundry.
the class WireMockTestFixture method startWireMock.
@PostConstruct
void startWireMock() {
wireMockServer = new WireMockServer(options().port(8088).httpsPort(8089).notifier(new Slf4jNotifier(true)));
wireMockServer.start();
}
use of com.github.tomakehurst.wiremock.common.Slf4jNotifier in project wiremock by wiremock.
the class WireMockWebContextListener method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent sce) {
ServletContext context = sce.getServletContext();
boolean verboseLoggingEnabled = Boolean.parseBoolean(firstNonNull(context.getInitParameter("verboseLoggingEnabled"), "true"));
WireMockApp wireMockApp = new WireMockApp(new WarConfiguration(context), new NotImplementedContainer());
context.setAttribute(APP_CONTEXT_KEY, wireMockApp);
context.setAttribute(StubRequestHandler.class.getName(), wireMockApp.buildStubRequestHandler());
context.setAttribute(AdminRequestHandler.class.getName(), wireMockApp.buildAdminRequestHandler());
context.setAttribute(Notifier.KEY, new Slf4jNotifier(verboseLoggingEnabled));
}
Aggregations