From 49414239fbc6203e4efa24416e57a215cd46a58c Mon Sep 17 00:00:00 2001 From: buildmaster Date: Wed, 27 Mar 2019 16:20:00 +0000 Subject: [PATCH] Sync docs from 1.2.x to gh-pages --- 1.2.x/multi/multi__contract_dsl.html | 4 +- 1.2.x/multi/multi__migrations.html | 2 +- .../multi__spring_cloud_contract_faq.html | 2 +- ...ti__spring_cloud_contract_stub_runner.html | 8 +- ..._cloud_contract_verifier_introduction.html | 4 +- ..._spring_cloud_contract_verifier_setup.html | 4 +- ...multi__spring_cloud_contract_wiremock.html | 4 +- 1.2.x/single/spring-cloud-contract.html | 28 +- .../license.html | 389 +++++++++++++----- 1.2.x/spring-cloud-contract.xml | 28 +- 10 files changed, 331 insertions(+), 142 deletions(-) diff --git a/1.2.x/multi/multi__contract_dsl.html b/1.2.x/multi/multi__contract_dsl.html index 3969020934..28e13caa32 100644 --- a/1.2.x/multi/multi__contract_dsl.html +++ b/1.2.x/multi/multi__contract_dsl.html @@ -41,7 +41,7 @@ the 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.

3.5.3 Consumer

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]Tip

You need to have Maven installed locally

3.5.4 Producer

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]Tip

You need to have Maven installed locally

3.5.4 Producer

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 {
 	}
 }

6.3 Stub Runner Core

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.

6.3.1 Retrieving stubs

You can pick the following options of acquiring stubs

  • Aether based solution that downloads JARs with stubs from Artifactory / Nexus
  • Classpath scanning solution that searches classpath via pattern to retrieve stubs
  • Write your own implementation of the org.springframework.cloud.contract.stubrunner.StubDownloaderBuilder for full customization

The latter example is described in the Custom Stub Runner section.

Stub downloading

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")

Classpath scanning

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")

Classpath scanning

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 variables

Spring Cloud Pipelines project for more information.

6.6.1 How to use it?

Stub Runner Server

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.

Stub Runner Server Fat Jar

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=...

Spring Cloud CLI

Starting from 1.4.0.RELEASE version of the Spring Cloud CLI +$ java -jar stub-runner.jar --stubrunner.ids=... --stubrunner.repositoryRoot=...

Spring Cloud CLI

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!

2.5 Dependencies

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!

2.5 Dependencies

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.

2.6 Additional Links

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.

2.6.1 Spring Cloud Contract video

You can check out the video from the Warsaw JUG about Spring Cloud Contract:

2.7 Samples

You can find some samples at +constant development.

2.6.1 Spring Cloud Contract video

You can check out the video from the Warsaw JUG about Spring Cloud Contract:

2.7 Samples

You can find some samples at samples.

\ No newline at end of file diff --git a/1.2.x/multi/multi__spring_cloud_contract_verifier_setup.html b/1.2.x/multi/multi__spring_cloud_contract_verifier_setup.html index abf8cae007..994d2822c5 100644 --- a/1.2.x/multi/multi__spring_cloud_contract_verifier_setup.html +++ b/1.2.x/multi/multi__spring_cloud_contract_verifier_setup.html @@ -3,7 +3,7 @@ 4. Spring Cloud Contract Verifier Setup

4. Spring Cloud Contract Verifier Setup

You can set up Spring Cloud Contract Verifier in the following ways:

4.1 Gradle Project

To learn how to set up the Gradle project for Spring Cloud Contract Verifier, read the following sections:

4.1.1 Prerequisites

In order to use Spring Cloud Contract Verifier with WireMock, you muse use either a Gradle or a Maven plugin.

[Warning]Warning

If you want to use Spock in your projects, you must add separately the -spock-core and spock-spring modules. Check Spock +spock-core and spock-spring modules. Check Spock docs for more information

4.1.2 Add Gradle Plugin with Dependencies

To add a Gradle plugin with dependencies, use code similar to this:

buildscript {
 	repositories {
 		mavenCentral()
@@ -555,7 +555,7 @@ like them to be available for others to download / reference or reuse. In case
 of the JVM world those artifacts would be JARs, for Ruby these are gems
 and for Docker those would be Docker images. You can store those artifacts
 in a manager. Examples of such managers can be Artifactory
-or Nexus.

4.6.2 How it works

The image searches for contracts under the /contracts folder. +or Nexus.

4.6.2 How it works

The image searches for contracts under the /contracts folder. The output from running the tests will be available under /spring-cloud-contract/build folder (it’s useful for debugging purposes).

It’s enough for you to mount your contracts, pass the environment variables diff --git a/1.2.x/multi/multi__spring_cloud_contract_wiremock.html b/1.2.x/multi/multi__spring_cloud_contract_wiremock.html index 77939c3d15..beb4c660c7 100644 --- a/1.2.x/multi/multi__spring_cloud_contract_wiremock.html +++ b/1.2.x/multi/multi__spring_cloud_contract_wiremock.html @@ -127,7 +127,7 @@ a Spring MockRestServiceServer. The following code public void contextLoads() throws Exception { // will read stubs classpath MockRestServiceServer server = WireMockRestServiceServer.with(this.restTemplate) - .baseUrl("http://example.org").stubs("classpath:/stubs/resource.json") + .baseUrl("https://example.org").stubs("classpath:/stubs/resource.json") .build(); // We're asserting if WireMock responded properly assertThat(this.service.go()).isEqualTo("Hello World"); @@ -136,7 +136,7 @@ a Spring MockRestServiceServer. The following code }

The baseUrl value is prepended to all mock calls, and the stubs() method takes a stub path resource pattern as an argument. In the preceding example, the stub defined at /stubs/resource.json is loaded into the mock server. If the RestTemplate is asked to -visit http://example.org/, it gets the responses as being declared at that URL. More +visit https://example.org/, it gets the responses as being declared at that URL. More than one stub pattern can be specified, and each one can be a directory (for a recursive list of all ".json"), a fixed filename (as in the example above), or an Ant-style pattern. The JSON format is the normal WireMock format, which you can read about in the diff --git a/1.2.x/single/spring-cloud-contract.html b/1.2.x/single/spring-cloud-contract.html index 3cf37f14c2..a6e1a5d615 100644 --- a/1.2.x/single/spring-cloud-contract.html +++ b/1.2.x/single/spring-cloud-contract.html @@ -557,10 +557,10 @@ 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!

2.5 Dependencies

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!

2.5 Dependencies

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.

2.6 Additional Links

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.

2.6.1 Spring Cloud Contract video

You can check out the video from the Warsaw JUG about Spring Cloud Contract:

2.7 Samples

You can find some samples at +constant development.

2.6.1 Spring Cloud Contract video

You can check out the video from the Warsaw JUG about Spring Cloud Contract:

2.7 Samples

You can find some samples at samples.

3. Spring Cloud Contract FAQ

3.1 Why use Spring Cloud Contract Verifier and not X ?

For the time being Spring Cloud Contract Verifier is a JVM based tool. So it could be your first pick when you’re already creating software for the JVM. This project has a lot of really interesting features but especially quite a few of them definitely make Spring Cloud Contract Verifier stand out on the "market" of Consumer Driven Contract (CDC) tooling. Out of many the most interesting are:

  • Possibility to do CDC with messaging
  • Clear and easy to use, statically typed DSL
  • Possibility to copy paste your current JSON file to the contract and only edit its elements
  • Automatic generation of tests from the defined Contract
  • Stub Runner functionality - the stubs are automatically downloaded at runtime from Nexus / Artifactory
  • Spring Cloud integration - no discovery service is needed for integration tests

3.2 I don’t want to write a contract in Groovy!

No problem. You can write a contract in YAML!

3.3 What is this value(consumer(), producer()) ?

One of the biggest challenges related to stubs is their reusability. Only if they can be vastly used, will they serve their purpose. @@ -836,7 +836,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.

3.5.3 Consumer

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]Tip

You need to have Maven installed locally

3.5.4 Producer

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]Tip

You need to have Maven installed locally

3.5.4 Producer

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>
@@ -863,7 +863,7 @@ DSL and provide a path relative to where the contract lays.
 If you’re using YAML just use the bodyFromFile property.

4. Spring Cloud Contract Verifier Setup

You can set up Spring Cloud Contract Verifier in the following ways:

4.1 Gradle Project

To learn how to set up the Gradle project for Spring Cloud Contract Verifier, read the following sections:

4.1.1 Prerequisites

In order to use Spring Cloud Contract Verifier with WireMock, you muse use either a Gradle or a Maven plugin.

[Warning]Warning

If you want to use Spock in your projects, you must add separately the -spock-core and spock-spring modules. Check Spock +spock-core and spock-spring modules. Check Spock docs for more information

4.1.2 Add Gradle Plugin with Dependencies

To add a Gradle plugin with dependencies, use code similar to this:

buildscript {
 	repositories {
 		mavenCentral()
@@ -1415,7 +1415,7 @@ like them to be available for others to download / reference or reuse. In case
 of the JVM world those artifacts would be JARs, for Ruby these are gems
 and for Docker those would be Docker images. You can store those artifacts
 in a manager. Examples of such managers can be Artifactory
-or Nexus.

4.6.2 How it works

The image searches for contracts under the /contracts folder. +or Nexus.

4.6.2 How it works

The image searches for contracts under the /contracts folder. The output from running the tests will be available under /spring-cloud-contract/build folder (it’s useful for debugging purposes).

It’s enough for you to mount your contracts, pass the environment variables @@ -1880,11 +1880,11 @@ publishing { } }

6.3 Stub Runner Core

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.

6.3.1 Retrieving stubs

You can pick the following options of acquiring stubs

  • Aether based solution that downloads JARs with stubs from Artifactory / Nexus
  • Classpath scanning solution that searches classpath via pattern to retrieve stubs
  • Write your own implementation of the org.springframework.cloud.contract.stubrunner.StubDownloaderBuilder for full customization

The latter example is described in the Custom Stub Runner section.

Stub downloading

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")

Classpath scanning

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")

Classpath scanning

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",
@@ -2213,7 +2213,7 @@ via the following system properties or environment variables

Spring Cloud Pipelines project for more information.

6.6.1 How to use it?

Stub Runner Server

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.

Stub Runner Server Fat Jar

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=...

Spring Cloud CLI

Starting from 1.4.0.RELEASE version of the Spring Cloud CLI +$ java -jar stub-runner.jar --stubrunner.ids=... --stubrunner.repositoryRoot=...

Spring Cloud CLI

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.  @@ -2330,7 +2330,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)
@@ -2821,7 +2821,7 @@ the 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"
 			}
 		}]
 	'''
@@ -3639,7 +3639,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 @@ -5252,7 +5252,7 @@ a Spring MockRestServiceServer. The following code public void contextLoads() throws Exception { // will read stubs classpath MockRestServiceServer server = WireMockRestServiceServer.with(this.restTemplate) - .baseUrl("http://example.org").stubs("classpath:/stubs/resource.json") + .baseUrl("https://example.org").stubs("classpath:/stubs/resource.json") .build(); // We're asserting if WireMock responded properly assertThat(this.service.go()).isEqualTo("Hello World"); @@ -5261,7 +5261,7 @@ a Spring MockRestServiceServer. The following code }

The baseUrl value is prepended to all mock calls, and the stubs() method takes a stub path resource pattern as an argument. In the preceding example, the stub defined at /stubs/resource.json is loaded into the mock server. If the RestTemplate is asked to -visit http://example.org/, it gets the responses as being declared at that URL. More +visit https://example.org/, it gets the responses as being declared at that URL. More than one stub pattern can be specified, and each one can be a directory (for a recursive list of all ".json"), a fixed filename (as in the example above), or an Ant-style pattern. The JSON format is the normal WireMock format, which you can read about in the @@ -5460,7 +5460,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/spring-cloud-contract-maven-plugin/license.html b/1.2.x/spring-cloud-contract-maven-plugin/license.html index cd22e55a77..d5940f2eb9 100644 --- a/1.2.x/spring-cloud-contract-maven-plugin/license.html +++ b/1.2.x/spring-cloud-contract-maven-plugin/license.html @@ -344,103 +344,268 @@ limitations under the License.

- - - - -
-
-
- Apache Logo -
-
- - - -
-
-
- - +
-
-
+ + + +
+
+ ApacheCon is Coming 9-12 Sept. 2019 - Las Vegas + The Apache Software Foundation +
+ +
+ Apache Support Logo +
+
+

Apache License

Version 2.0, January 2004

http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

@@ -710,8 +886,8 @@ limitations under the License.
-

Copyright © 2018 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.

-

Apache and the Apache feather logo are trademarks of The Apache Software Foundation.

+

Copyright © 2019 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.

+

Apache and the Apache feather logo are trademarks of The Apache Software Foundation.

@@ -720,8 +896,21 @@ limitations under the License. - - + + +
diff --git a/1.2.x/spring-cloud-contract.xml b/1.2.x/spring-cloud-contract.xml index 61d126d06e..323d9077ea 100644 --- a/1.2.x/spring-cloud-contract.xml +++ b/1.2.x/spring-cloud-contract.xml @@ -924,7 +924,7 @@ the workOffline parameter in your annotation. The following c achieving the same thing by changing the properties. stubrunner: ids: 'com.example:http-server-dsl:+:stubs:8080' - repositoryRoot: http://repo.spring.io/libs-snapshot + repositoryRoot: https://repo.spring.io/libs-snapshot That’s it! @@ -948,7 +948,7 @@ constant development. Readings -Slides from Marcin Grzejszczak’s talk about Accurest +Slides from Marcin Grzejszczak’s talk about Accurest Accurest related articles from Marcin Grzejszczak’s blog @@ -1367,7 +1367,7 @@ Those poms are necessary for the consumer side to run mvn clean install 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. -You need to have Maven installed locally +You need to have Maven installed locally
@@ -1492,7 +1492,7 @@ following sections: Gradle or a Maven plugin. If you want to use Spock in your projects, you must add separately the -spock-core and spock-spring modules. Check Spock +spock-core and spock-spring modules. Check Spock docs for more information
@@ -2450,7 +2450,7 @@ like them to be available for others to download / reference or reuse. In case of the JVM world those artifacts would be JARs, for Ruby these are gems and for Docker those would be Docker images. You can store those artifacts in a manager. Examples of such managers can be Artifactory -or Nexus. +or Nexus.
@@ -3210,7 +3210,7 @@ publishing {
Stub Runner Core Runs stubs for service collaborators. Treating stubs as contracts of services allows to use stub-runner as an implementation of -Consumer Driven Contracts. +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.
@@ -3235,7 +3235,7 @@ to true then Stub Runner will connect to the given server and 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") +@AutoConfigureStubRunner(repositoryRoot="https://foo.bar", ids = "com.example:beer-api-producer:+:stubs:8095")
Classpath scanning @@ -3793,7 +3793,7 @@ $ java -jar stub-runner.jar --stubrunner.ids=... --stubrunner.repositoryRoot=...
Spring Cloud CLI -Starting from 1.4.0.RELEASE version of the Spring Cloud CLI +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 @@ -3959,7 +3959,7 @@ and we want to have the stub runner feature turned on @AutoConfigureStu 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) +-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) @@ -4912,7 +4912,7 @@ the Contract class: import org.springframework.cloud "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" } }] ''' @@ -6082,7 +6082,7 @@ 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. @@ -8280,7 +8280,7 @@ public class WiremockForDocsMockServerApplicationTests { public void contextLoads() throws Exception { // will read stubs classpath MockRestServiceServer server = WireMockRestServiceServer.with(this.restTemplate) - .baseUrl("http://example.org").stubs("classpath:/stubs/resource.json") + .baseUrl("https://example.org").stubs("classpath:/stubs/resource.json") .build(); // We're asserting if WireMock responded properly assertThat(this.service.go()).isEqualTo("Hello World"); @@ -8290,7 +8290,7 @@ public class WiremockForDocsMockServerApplicationTests { The baseUrl value is prepended to all mock calls, and the stubs() method takes a stub path resource pattern as an argument. In the preceding example, the stub defined at /stubs/resource.json is loaded into the mock server. If the RestTemplate is asked to -visit http://example.org/, it gets the responses as being declared at that URL. More +visit https://example.org/, it gets the responses as being declared at that URL. More than one stub pattern can be specified, and each one can be a directory (for a recursive list of all ".json"), a fixed filename (as in the example above), or an Ant-style pattern. The JSON format is the normal WireMock format, which you can read about in the @@ -8556,7 +8556,7 @@ structure presented in the previous snippet. <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>