From f65e6fc579c82e05548461542dfdea9ce95be3c9 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Tue, 30 May 2017 13:52:26 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- spring-cloud-contract.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/spring-cloud-contract.html b/spring-cloud-contract.html index 05fa9fb6b7..da935619e5 100644 --- a/spring-cloud-contract.html +++ b/spring-cloud-contract.html @@ -9003,9 +9003,12 @@ You wrote a proper stub generator and your stubs got placed in a JAR file.

import com.github.dreamhead.moco.bootstrap.arg.HttpArgs import com.github.dreamhead.moco.runner.JsonRunner +import com.github.dreamhead.moco.runner.RunnerSetting +import groovy.util.logging.Slf4j import org.springframework.cloud.contract.stubrunner.HttpServerStub import org.springframework.util.SocketUtils +@Slf4j class MocoHttpServerStub implements HttpServerStub { private boolean started @@ -9047,8 +9050,16 @@ class MocoHttpServerStub implements HttpServerStub { @Override HttpServerStub registerMappings(Collection<File> stubFiles) { - List<InputStream> streams = stubFiles.collect { it.newInputStream() } - this.runner = JsonRunner.newJsonRunnerWithStreams(streams, + List<RunnerSetting> settings = stubFiles.findAll { it.name.endsWith("json") } + .collect { + try { + return RunnerSetting.aRunnerSetting().withStream(it.newInputStream()).build() + } catch (Exception e) { + log.warn("Exception occurred while trying to parse file [{}]", it.name, e) + return null + } + }.findAll { it } + this.runner = JsonRunner.newJsonRunnerWithSetting(settings, HttpArgs.httpArgs().withPort(this.port).build()) this.runner.run() this.started = true