From 49414239fbc6203e4efa24416e57a215cd46a58c Mon Sep 17 00:00:00 2001
From: buildmaster Contract class: import or
"id":"01fbe706f872cb32",
"name":"Washington",
"place_type":"city",
- "url": "http://api.twitter.com/1/geo/id/01fbe706f872cb32.json"
+ "url": "https://api.twitter.com/1/geo/id/01fbe706f872cb32.json"
}
}]
'''
@@ -859,7 +859,7 @@ you reference a bunch of elements from the HTTP request. You can use the followi
options:
fromRequest().url(): Returns the request URL and query parameters.fromRequest().query(String key): Returns the first query parameter with a given name.fromRequest().query(String key, int index): Returns the nth query parameter with a
given name.fromRequest().path(): Returns the full path.fromRequest().path(int index): Returns the nth path element.fromRequest().header(String key): Returns the first header with a given name.fromRequest().header(String key, int index): Returns the nth header with a given name.fromRequest().body(): Returns the full request body.fromRequest().body(String jsonPath): Returns the element from the request that
matches the JSON Path.If you’re using the YAML contract definition you have to use the
-Handlebars {{{ }}} notation with custom, Spring Cloud Contract
+Handlebars {{{ }}} notation with custom, Spring Cloud Contract
functions to achieve this.
{{{ request.url }}}: Returns the request URL and query parameters.{{{ request.query.key.[index] }}}: Returns the nth query parameter with a given name.
E.g. for key foo, first entry {{{ request.query.foo.[0] }}}{{{ request.path }}}: Returns the full path.{{{ request.path.[index] }}}: Returns the nth path element. E.g.
for first entry `{{{ request.path.[0] }}}{{{ request.headers.key }}}: Returns the first header with a given name.{{{ request.headers.key.[index] }}}: Returns the nth header with a given name.{{{ request.body }}}: Returns the full request body.{{{ jsonpath this 'your.json.path' }}}: Returns the element from the request that
diff --git a/1.2.x/multi/multi__migrations.html b/1.2.x/multi/multi__migrations.html
index 7e5efdbd88..1cd754c258 100644
--- a/1.2.x/multi/multi__migrations.html
+++ b/1.2.x/multi/multi__migrations.html
@@ -48,7 +48,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/1.2.x/multi/multi__spring_cloud_contract_faq.html b/1.2.x/multi/multi__spring_cloud_contract_faq.html
index e603c5a6e9..0438b9b1ff 100644
--- a/1.2.x/multi/multi__spring_cloud_contract_faq.html
+++ b/1.2.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> diff --git a/1.2.x/multi/multi__spring_cloud_contract_stub_runner.html b/1.2.x/multi/multi__spring_cloud_contract_stub_runner.html index 4286a60e01..b6ab0b92c5 100644 --- a/1.2.x/multi/multi__spring_cloud_contract_stub_runner.html +++ b/1.2.x/multi/multi__spring_cloud_contract_stub_runner.html @@ -158,11 +158,11 @@ 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.
If you provide the stubrunner.repositoryRoot or stubrunner.workOffline flag will be set
to true then Stub Runner will connect to the given server and download the required jars.
It will then unpack the JAR to a temporary folder and reference those files in further
-contract processing.
Example:
@AutoConfigureStubRunner(repositoryRoot="http://foo.bar", ids = "com.example:beer-api-producer:+:stubs:8095")
If you DON’T provide the stubrunner.repositoryRoot and stubrunner.workOffline flag will
+contract processing.
Example:
@AutoConfigureStubRunner(repositoryRoot="https://foo.bar", ids = "com.example:beer-api-producer:+:stubs:8095")
If you DON’T provide the stubrunner.repositoryRoot and stubrunner.workOffline flag will
be set to false (that’s the default) then classpath will get scanned. Let’s look at the
following example:
@AutoConfigureStubRunner(ids = {
"com.example:beer-api-producer:+:stubs:8095",
@@ -491,7 +491,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.
@@ -608,7 +608,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/1.2.x/multi/multi__spring_cloud_contract_verifier_introduction.html b/1.2.x/multi/multi__spring_cloud_contract_verifier_introduction.html
index 24d31f89ea..e6e66d4494 100644
--- a/1.2.x/multi/multi__spring_cloud_contract_verifier_introduction.html
+++ b/1.2.x/multi/multi__spring_cloud_contract_verifier_introduction.html
@@ -552,8 +552,8 @@ side are automatically downloaded from Nexus/Artifactory. You can switch off the
the workOffline parameter in your annotation. 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-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.