|
|
|
|
@@ -1123,7 +1123,7 @@ following resources in your project:</p>
|
|
|
|
|
<div class="title">groovy</div>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">/*
|
|
|
|
|
* Copyright 2013-2019 the original author or authors.
|
|
|
|
|
* Copyright 2013-2020 the original author or authors.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
@@ -6085,8 +6085,8 @@ work.
|
|
|
|
|
</td>
|
|
|
|
|
<td class="content">
|
|
|
|
|
<div class="paragraph">
|
|
|
|
|
<p>If you want to use Spring Cloud Stream, remember to add a dependency on
|
|
|
|
|
<code>org.springframework.cloud:spring-cloud-stream-test-support</code>, as follows:</p>
|
|
|
|
|
<p>If you want to use Spring Cloud Stream, remember to add a test dependency on
|
|
|
|
|
<code>org.springframework.cloud:spring-cloud-stream</code>, as follows:</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="exampleblock">
|
|
|
|
|
<div class="content">
|
|
|
|
|
@@ -6095,15 +6095,17 @@ work.
|
|
|
|
|
<div class="content">
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><dependency>
|
|
|
|
|
<groupId>org.springframework.cloud</groupId>
|
|
|
|
|
<artifactId>spring-cloud-stream-test-support</artifactId>
|
|
|
|
|
<artifactId>spring-cloud-stream</artifactId>
|
|
|
|
|
<type>test-jar</type>
|
|
|
|
|
<scope>test</scope>
|
|
|
|
|
<classifier>test-binder</classifier>
|
|
|
|
|
</dependency></code></pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="listingblock secondary">
|
|
|
|
|
<div class="title">Gradle</div>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">testCompile "org.springframework.cloud:spring-cloud-stream-test-support"</code></pre>
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">testImplementation(group: 'org.springframework.cloud', name: 'spring-cloud-stream', classifier: 'test-binder')</code></pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@@ -7313,7 +7315,7 @@ destination is resolved as a channel name.
|
|
|
|
|
<td class="content">
|
|
|
|
|
<div class="paragraph">
|
|
|
|
|
<p>If you want to use Spring Cloud Stream, remember to add a dependency on
|
|
|
|
|
<code>org.springframework.cloud:spring-cloud-stream-test-support</code>, as follows:</p>
|
|
|
|
|
<code>org.springframework.cloud:spring-cloud-stream</code> test support, as follows:</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="exampleblock">
|
|
|
|
|
<div class="content">
|
|
|
|
|
@@ -7322,15 +7324,17 @@ destination is resolved as a channel name.
|
|
|
|
|
<div class="content">
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><dependency>
|
|
|
|
|
<groupId>org.springframework.cloud</groupId>
|
|
|
|
|
<artifactId>spring-cloud-stream-test-support</artifactId>
|
|
|
|
|
<artifactId>spring-cloud-stream</artifactId>
|
|
|
|
|
<type>test-jar</type>
|
|
|
|
|
<scope>test</scope>
|
|
|
|
|
<classifier>test-binder</classifier>
|
|
|
|
|
</dependency></code></pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="listingblock secondary">
|
|
|
|
|
<div class="title">Gradle</div>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">testCompile "org.springframework.cloud:spring-cloud-stream-test-support"</code></pre>
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">testImplementation(group: 'org.springframework.cloud', name: 'spring-cloud-stream', classifier: 'test-binder')</code></pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@@ -9406,12 +9410,12 @@ The following example achieves the same result by setting values on the annotati
|
|
|
|
|
</div>
|
|
|
|
|
<div class="listingblock">
|
|
|
|
|
<div class="content">
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">//@AutoConfigureStubRunner(
|
|
|
|
|
// ids = ["org.springframework.cloud.contract.verifier.stubs:loanIssuance",
|
|
|
|
|
// "org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer",
|
|
|
|
|
// "org.springframework.cloud.contract.verifier.stubs:bootService"],
|
|
|
|
|
// stubsMode = StubRunnerProperties.StubsMode.REMOTE,
|
|
|
|
|
// repositoryRoot = "classpath:m2repo/repository/")</code></pre>
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">@AutoConfigureStubRunner(
|
|
|
|
|
ids = ["org.springframework.cloud.contract.verifier.stubs:loanIssuance",
|
|
|
|
|
"org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer",
|
|
|
|
|
"org.springframework.cloud.contract.verifier.stubs:bootService"],
|
|
|
|
|
stubsMode = StubRunnerProperties.StubsMode.REMOTE,
|
|
|
|
|
repositoryRoot = "classpath:m2repo/repository/")</code></pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="paragraph">
|
|
|
|
|
@@ -9505,14 +9509,14 @@ instead of calling the real Service Discovery tool.</p>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<div class="listingblock">
|
|
|
|
|
<div class="content">
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">// def 'should make service discovery work'() {
|
|
|
|
|
// expect: 'WireMocks are running'
|
|
|
|
|
// "${stubFinder.findStubUrl('loanIssuance').toString()}/name".toURL().text == 'loanIssuance'
|
|
|
|
|
// "${stubFinder.findStubUrl('fraudDetectionServer').toString()}/name".toURL().text == 'fraudDetectionServer'
|
|
|
|
|
// and: 'Stubs can be reached via load service discovery'
|
|
|
|
|
// restTemplate.getForObject('http://loanIssuance/name', String) == 'loanIssuance'
|
|
|
|
|
// restTemplate.getForObject('http://someNameThatShouldMapFraudDetectionServer/name', String) == 'fraudDetectionServer'
|
|
|
|
|
// }</code></pre>
|
|
|
|
|
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">def 'should make service discovery work'() {
|
|
|
|
|
expect: 'WireMocks are running'
|
|
|
|
|
"${stubFinder.findStubUrl('loanIssuance').toString()}/name".toURL().text == 'loanIssuance'
|
|
|
|
|
"${stubFinder.findStubUrl('fraudDetectionServer').toString()}/name".toURL().text == 'fraudDetectionServer'
|
|
|
|
|
and: 'Stubs can be reached via load service discovery'
|
|
|
|
|
restTemplate.getForObject('http://loanIssuance/name', String) == 'loanIssuance'
|
|
|
|
|
restTemplate.getForObject('http://someNameThatShouldMapFraudDetectionServer/name', String) == 'fraudDetectionServer'
|
|
|
|
|
}</code></pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@@ -9996,6 +10000,7 @@ Alternatively, you can set the test as follows:</p>
|
|
|
|
|
repositoryRoot = "classpath:m2repo/repository/",
|
|
|
|
|
stubsMode = StubRunnerProperties.StubsMode.REMOTE,
|
|
|
|
|
stubsPerConsumer = true)
|
|
|
|
|
@ActiveProfiles("streamconsumer")
|
|
|
|
|
class StubRunnerStubsPerConsumerSpec extends Specification {
|
|
|
|
|
...
|
|
|
|
|
}</code></pre>
|
|
|
|
|
@@ -10021,6 +10026,7 @@ class StubRunnerStubsPerConsumerSpec extends Specification {
|
|
|
|
|
consumerName = "foo-consumer",
|
|
|
|
|
stubsMode = StubRunnerProperties.StubsMode.REMOTE,
|
|
|
|
|
stubsPerConsumer = true)
|
|
|
|
|
@ActiveProfiles("streamconsumer")
|
|
|
|
|
class StubRunnerStubsPerConsumerWithConsumerNameSpec extends Specification {
|
|
|
|
|
...
|
|
|
|
|
}</code></pre>
|
|
|
|
|
|