Updated the documentation
This commit is contained in:
@@ -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
|
||||
----
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user