From 7c1eb995ae68a38f3b90ced6eec06555a261a1af Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Fri, 10 Mar 2017 12:57:04 +0100 Subject: [PATCH] Added links to samples with stub runner cloud fixes #241 --- spring-cloud-contract-stub-runner/README.adoc | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spring-cloud-contract-stub-runner/README.adoc b/spring-cloud-contract-stub-runner/README.adoc index ab207b8fb8..3daf8e3903 100644 --- a/spring-cloud-contract-stub-runner/README.adoc +++ b/spring-cloud-contract-stub-runner/README.adoc @@ -197,6 +197,11 @@ Which you can reference in your code. Stub Runner can integrate with Spring Cloud. +For real life examples you can check the + + - https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/master/producer[producer app sample] + - https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/master/consumer_with_discovery[consumer app sample] + ==== Stubbing Service Discovery The most important feature of `Stub Runner Spring Cloud` is the fact that it's stubbing @@ -222,6 +227,24 @@ for the following configuration file include::src/test/resources/application.yml[] ---- +===== Test profiles and service discovery + +In your integration tests you typically don't want to call neither a discovery service (e.g. Eureka) +or Config Server. That's why you create an additional test configuration in which you want to disable +these features. + +Due to certain limitations of https://github.com/spring-cloud/spring-cloud-commons/issues/156[`spring-cloud-commons`] to achieve this you have disable these properties +via a static block like presented below (example for Eureka) + +[source,java] +---- + //Hack to work around https://github.com/spring-cloud/spring-cloud-commons/issues/156 + static { + System.setProperty("eureka.client.enabled", "false"); + System.setProperty("spring.cloud.config.failFast", "false"); + } +---- + ==== Additional Configuration You can match the artifactId of the stub with the name of your app by using the `stubrunner.idsToServiceIds:` map.