Updated the documentation

This commit is contained in:
Marcin Grzejszczak
2016-08-24 17:54:01 +02:00
parent 5d3e99874f
commit 43082d8ca6
4 changed files with 17 additions and 8 deletions

View File

@@ -673,7 +673,7 @@ Provide the group id and artifact id for the Stub Runner to download stubs of yo
----
stubrunner:
work-offline: true
stubs.ids: 'com.example:http-server-dsl:+:stubs:8080'
ids: 'com.example:http-server-dsl:+:stubs:8080'
----
Annotate your test class with `@AutoConfigureStubRunner`
@@ -682,7 +682,7 @@ Annotate your test class with `@AutoConfigureStubRunner`
----
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureStubRunner
@AutoConfigureStubRunner(ids = {"com.example:http-server-dsl:+:stubs:8080"}, workOffline = true)
public class LoanApplicationServiceTests {
----
@@ -876,7 +876,7 @@ Now you can disable the offline work for Spring Cloud Contract Stub Runner ad pr
[source,yaml,indent=0]
----
stubrunner.stubs:
stubrunner:
ids: 'com.example:http-server-dsl:+:stubs:8080'
repositoryRoot: http://repo.spring.io/libs-snapshot
----

View File

@@ -148,9 +148,18 @@ for the following configuration file:
[source,yml,indent=0]
----
include::src/test/resources/application.yml[]
include::src/test/resources/application-test.yml[]
----
Instead of using the properties you can also use the properties inside the `@AutoConfigureStubRunner`.
Below you can find an example of achieving the same result by setting values on the annotation.
[source,groovy,indent=0]
----
include::src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy[tags=autoconfigure]
----
=== Stub Runner Spring Cloud
Stub Runner can integrate with Spring Cloud.

View File

@@ -44,11 +44,13 @@ import spock.lang.Specification
@ContextConfiguration(classes = Config, loader = SpringBootContextLoader)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = ["stubrunner.camel.enabled=false"])
@AutoConfigureStubRunner(ids =
["org.springframework.cloud.contract.verifier.stubs:loanIssuance",
// tag::autoconfigure[]
@AutoConfigureStubRunner(
ids = ["org.springframework.cloud.contract.verifier.stubs:loanIssuance",
"org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer",
"org.springframework.cloud.contract.verifier.stubs:bootService"],
repositoryRoot = "classpath:m2repo/repository/")
// end::autoconfigure[]
@DirtiesContext
class StubRunnerSpringCloudAutoConfigurationSpec extends Specification {

View File

@@ -59,7 +59,6 @@ class StubRunnerSpringCloudAutoConfigurationWithoutDiscoverySpec extends Specifi
System.clearProperty("stubrunner.stubs.classifier");
}
// tag::test[]
def 'should make service discovery work'() {
expect: 'WireMocks are running'
"${stubFinder.findStubUrl('loanIssuance').toString()}/name".toURL().text == 'loanIssuance'
@@ -68,7 +67,6 @@ class StubRunnerSpringCloudAutoConfigurationWithoutDiscoverySpec extends Specifi
restTemplate.getForObject('http://loanIssuance/name', String) == 'loanIssuance'
restTemplate.getForObject('http://someNameThatShouldMapFraudDetectionServer/name', String) == 'fraudDetectionServer'
}
// end::test[]
@Configuration
@EnableAutoConfiguration(exclude = [RibbonZookeeperAutoConfiguration])