diff --git a/2.0.x/multi/multi__migrations.html b/2.0.x/multi/multi__migrations.html index 9d777b3c08..a65fe452ff 100644 --- a/2.0.x/multi/multi__migrations.html +++ b/2.0.x/multi/multi__migrations.html @@ -49,7 +49,7 @@ structure presented in the previous snippet.
Maven.&nbs
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 https://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>stubs</id>
<formats>
<format>jar</format>
diff --git a/2.0.x/multi/multi__spring_cloud_contract_faq.html b/2.0.x/multi/multi__spring_cloud_contract_faq.html
index 03836d34ec..7dcaa21022 100644
--- a/2.0.x/multi/multi__spring_cloud_contract_faq.html
+++ b/2.0.x/multi/multi__spring_cloud_contract_faq.html
@@ -275,7 +275,7 @@ Those poms are necessary for the consumer side to run mvn
is that the producer doesn’t own the contracts anymore. So the consumer and the producer have to work on
common contracts in a common repository.
When the consumer wants to work on the contracts offline, instead of cloning the producer code, the
consumer team clones the common repository, goes to the required producer’s folder (e.g. com/example/server)
-and runs mvn clean install -DskipTests to install locally the stubs converted from the contracts.
![]() | Tip |
|---|---|
You need to have Maven installed locally |
As a producer it’s enough to alter the Spring Cloud Contract Verifier to provide the URL and the dependency
+and runs mvn clean install -DskipTests to install locally the stubs converted from the contracts.
![]() | Tip |
|---|---|
You need to have Maven installed locally |
As a producer it’s enough to alter the Spring Cloud Contract Verifier to provide the URL and the dependency of the JAR containing the contracts:
<plugin> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-maven-plugin</artifactId> @@ -507,7 +507,7 @@ SCM repository, prefixed with the protocol. For example"com.example:bookstore:0.0.1.RELEASE" )With such a setup:
- Git project will be cloned to a temporary directory
- The SCM stub downloader will go to
META-INF/groupId/artifactId/version/folder to find stub definitions and contracts. E.g. forcom.example:foo:1.0.0the path would be -META-INF/com.example/foo/1.0.0/- Stub servers will be started and fed with mappings
- Messaging definitions will be read and used in the messaging tests
When using Pact you can use the Pact Broker
+META-INF/com.example/foo/1.0.0/
When using Pact you can use the Pact Broker to store and share Pact definitions. Starting from Spring Cloud Contract 2.0.0 one can fetch Pact files from the Pact Broker to generate tests and stubs.
As a prerequisite the Pact Converter and Pact Stub Downloader diff --git a/2.0.x/multi/multi__spring_cloud_contract_stub_runner.html b/2.0.x/multi/multi__spring_cloud_contract_stub_runner.html index cab7f0cf59..d0d92462d0 100644 --- a/2.0.x/multi/multi__spring_cloud_contract_stub_runner.html +++ b/2.0.x/multi/multi__spring_cloud_contract_stub_runner.html @@ -158,9 +158,9 @@ publishing { } }
Runs stubs for service collaborators. Treating stubs as contracts of services allows to use stub-runner as an implementation of -Consumer Driven Contracts.
Stub Runner allows you to automatically download the stubs of the provided dependencies (or pick those from the classpath), start WireMock servers for them and feed them with proper stub definitions. +Consumer Driven Contracts.
Stub Runner allows you to automatically download the stubs of the provided dependencies (or pick those from the classpath), start WireMock servers for them and feed them with proper stub definitions. For messaging, special stub routes are defined.
You can pick the following options of acquiring stubs
org.springframework.cloud.contract.stubrunner.StubDownloaderBuilder for full customizationThe latter example is described in the Custom Stub Runner section.
You can control the stub downloading via the stubsMode switch. It picks value from the
-StubRunnerProperties.StubsMode enum. You can use the following options
StubRunnerProperties.StubsMode.CLASSPATH (default value) - will pick stubs from the classpathStubRunnerProperties.StubsMode.LOCAL - will pick stubs from a local storage (e.g. .m2)StubRunnerProperties.StubsMode.REMOTE - will pick stubs from a remote locationExample:
@AutoConfigureStubRunner(repositoryRoot="http://foo.bar", ids = "com.example:beer-api-producer:+:stubs:8095", stubsMode = StubRunnerProperties.StubsMode.LOCAL)
If you set the stubsMode property to StubRunnerProperties.StubsMode.CLASSPATH
+StubRunnerProperties.StubsMode enum. You can use the following options
StubRunnerProperties.StubsMode.CLASSPATH (default value) - will pick stubs from the classpathStubRunnerProperties.StubsMode.LOCAL - will pick stubs from a local storage (e.g. .m2)StubRunnerProperties.StubsMode.REMOTE - will pick stubs from a remote locationExample:
@AutoConfigureStubRunner(repositoryRoot="https://foo.bar", ids = "com.example:beer-api-producer:+:stubs:8095", stubsMode = StubRunnerProperties.StubsMode.LOCAL)
If you set the stubsMode property to StubRunnerProperties.StubsMode.CLASSPATH
(or set nothing since CLASSPATH is the default value) then classpath will get scanned.
Let’s look at the following example:
@AutoConfigureStubRunner(ids = {
"com.example:beer-api-producer:+:stubs:8095",
@@ -513,7 +513,7 @@ via the following system properties or environment variablesSpring Cloud Pipelines
project for more information.Just add the
compile "org.springframework.cloud:spring-cloud-starter-stub-runner"Annotate a class with @EnableStubRunnerServer, build a fat-jar and you’re ready to go!
For the properties check the Stub Runner Spring section.
You can download a standalone JAR from Maven (for example, for version 1.2.3.RELEASE), as follows:
$ wget -O stub-runner.jar 'https://search.maven.org/remote_content?g=org.springframework.cloud&a=spring-cloud-contract-stub-runner-boot&v=1.2.3.RELEASE'
-$ java -jar stub-runner.jar --stubrunner.ids=... --stubrunner.repositoryRoot=...Starting from 1.4.0.RELEASE version of the Spring Cloud CLI
+$ java -jar stub-runner.jar --stubrunner.ids=... --stubrunner.repositoryRoot=...
Starting from 1.4.0.RELEASE version of the Spring Cloud CLI
project you can start Stub Runner Boot by executing spring cloud stubrunner.
In order to pass the configuration just create a stubrunner.yml file in the current working directory
or a subdirectory called config or in ~/.spring-cloud. The file could look like this
(example for running stubs installed locally)
stubrunner.yml.
@@ -630,7 +630,7 @@ the Stub Runner server. It will be available at port 8750<
}As you can see we want to start a Stub Runner Boot server @EnableStubRunnerServer, enable Eureka client @EnableEurekaClient
and we want to have the stub runner feature turned on @AutoConfigureStubRunner.
Now let’s assume that we want to start this application so that the stubs get automatically registered.
We can do it by running the app java -jar ${SYSTEM_PROPS} stub-runner-boot-eureka-example.jar where
- ${SYSTEM_PROPS} would contain the following list of properties
-Dstubrunner.repositoryRoot=http://repo.spring.io/snapshots (1)
+ ${SYSTEM_PROPS} would contain the following list of properties
-Dstubrunner.repositoryRoot=https://repo.spring.io/snapshots (1)
-Dstubrunner.cloud.stubbed.discovery.enabled=false (2)
-Dstubrunner.ids=org.springframework.cloud.contract.verifier.stubs:loanIssuance,org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer,org.springframework.cloud.contract.verifier.stubs:bootService (3)
-Dstubrunner.idsToServiceIds.fraudDetectionServer=someNameThatShouldMapFraudDetectionServer (4)
diff --git a/2.0.x/multi/multi__spring_cloud_contract_verifier_introduction.html b/2.0.x/multi/multi__spring_cloud_contract_verifier_introduction.html
index 0b0f29c12c..80b39ee594 100644
--- a/2.0.x/multi/multi__spring_cloud_contract_verifier_introduction.html
+++ b/2.0.x/multi/multi__spring_cloud_contract_verifier_introduction.html
@@ -62,7 +62,7 @@ in place yet, so the automatically-generated contract tests fail.<
pass the stub artifact IDs and artifact repository URL as Spring Cloud Contract
Stub Runner properties, as shown in the following example:stubrunner:
ids: 'com.example:http-server-dsl:+:stubs:8080'
- repositoryRoot: http://repo.spring.io/libs-snapshot
Now you can annotate your test class with @AutoConfigureStubRunner. In the annotation,
+ repositoryRoot: https://repo.spring.io/libs-snapshot
Now you can annotate your test class with @AutoConfigureStubRunner. In the annotation,
provide the group-id and artifact-id values for Spring Cloud Contract Stub Runner to
run the collaborators' stubs for you, as shown in the following example:
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment=WebEnvironment.NONE)
@@ -223,7 +223,7 @@ in place, so the automatically-generated contract tests fail.Spring Cloud Contract Stub
Runner properties, as shown in the following example:stubrunner:
ids: 'com.example:http-server-dsl:+:stubs:8080'
- repositoryRoot: http://repo.spring.io/libs-snapshot
Now you can annotate your test class with @AutoConfigureStubRunner. In the annotation,
+ repositoryRoot: https://repo.spring.io/libs-snapshot
Now you can annotate your test class with @AutoConfigureStubRunner. In the annotation,
provide the group-id and artifact-id for Spring Cloud Contract Stub Runner to run
the collaborators' stubs for you, as shown in the following example:
@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment=WebEnvironment.NONE) @@ -767,8 +767,8 @@ side are automatically downloaded from Nexus/Artifactory. You can set the valuestubsModetoREMOTE. The following code shows an example of achieving the same thing by changing the properties.stubrunner: ids: 'com.example:http-server-dsl:+:stubs:8080' - repositoryRoot: http://repo.spring.io/libs-snapshotThat’s it!
The best way to add dependencies is to use the proper starter dependency.
For stub-runner, use spring-cloud-starter-stub-runner. When you use a plugin, add
+ repositoryRoot: https://repo.spring.io/libs-snapshot
That’s it!
The best way to add dependencies is to use the proper starter dependency.
For stub-runner, use spring-cloud-starter-stub-runner. When you use a plugin, add
spring-cloud-starter-contract-verifier.
Here are some resources related to Spring Cloud Contract Verifier and Stub Runner. Note that some may be outdated, because the Spring Cloud Contract Verifier project is under -constant development.
You can check out the video from the Warsaw JUG about Spring Cloud Contract:
You can find some samples at +constant development.
You can check out the video from the Warsaw JUG about Spring Cloud Contract:
You can find some samples at samples.