Don't use ServerProperties for configuring Wiremock server

The problem is that it is a Spring Boot app (really tiny one), so
it binds to server.* in the environment, if you try to use
the stock ServerProperties. We only need a subset of the features
so it's actually relatively easy to wrap it and use a delegate.
This commit is contained in:
Dave Syer
2016-11-09 16:12:23 +00:00
parent 235af1df1e
commit 891452376b
14 changed files with 235 additions and 140 deletions

View File

@@ -5,8 +5,10 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.cloud.contract.stubrunner.StubFinder;
import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import com.example.loan.model.Client;
@@ -18,9 +20,10 @@ import static org.assertj.core.api.Assertions.assertThat;
// tag::autoconfigure_stubrunner[]
@RunWith(SpringRunner.class)
@SpringBootTest
@SpringBootTest(webEnvironment=WebEnvironment.NONE)
@AutoConfigureStubRunner(repositoryRoot = "classpath:m2repo/repository/",
ids = { "org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer" })
@DirtiesContext
public class LoanApplicationServiceTests {
// end::autoconfigure_stubrunner[]