Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions docs/modules/ROOT/pages/_additional-stubrunner-configprops.adoc
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
IMPORTANT: The following properties can be passed as a system property (for example, `stubrunner.properties.git.branch`), as an environment variable (for example, `STUBRUNNER_PROPERTIES_GIT_BRANCH`), or as a property inside stub runner's annotation or a JUnit Rule (JUnit 4) or Extension (JUnit 5). In the latter case, you can pass the `git.branch` property instead of `stubrunner.properties.git.branch`.
IMPORTANT: The following properties can be passed as a system property (for example, `spring.cloud.contract.stubrunner.properties.git.branch`), as an environment variable (for example, `SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_GIT_BRANCH`), or as a property inside stub runner's annotation or a JUnit Rule (JUnit 4) or Extension (JUnit 5). In the latter case, you can pass the `git.branch` property instead of `spring.cloud.contract.stubrunner.properties.git.branch`.

.Stubrunner Properties Options
|===
|Name | Default | Description

|`stubrunner.properties.git.branch` | | When using the SCM-based approach, you can customize the branch name to check out.
|`stubrunner.properties.git.commit-message` | Updating project [$project] with stubs | When using the SCM based approach, you can customize the commit message for created stubs. The `$project` text is replaced with the project name.
|`stubrunner.properties.git.no-of-attempts` | `10` | When using the-SCM based approach, you can customize the number of retries to push the stubs to Git.
|`stubrunner.properties.git.username` | | When using the SCM-based approach, you can pass the username to connect to the git repository.
|`stubrunner.properties.git.password` | | When using the SCM-based approach, you can pass the password to connect to the git repository.
|`stubrunner.properties.git.wait-between-attempts` | `1000` | When using the SCM-based approach, you can customize waiting time in ms between attempts to push the stubs to git.
|`stubrunner.properties.git.ensure-git-suffix` | `true` | When using the SCM based approach, you can prevent stubrunner from adding `.git` to the repository URL by setting this property to `false`. This adds compatibility with git repositories which do not support such URLs, for example Azure DevOps.
|`spring.cloud.contract.stubrunner.properties.git.branch` | | When using the SCM-based approach, you can customize the branch name to check out.
|`spring.cloud.contract.stubrunner.properties.git.commit-message` | Updating project [$project] with stubs | When using the SCM based approach, you can customize the commit message for created stubs. The `$project` text is replaced with the project name.
|`spring.cloud.contract.stubrunner.properties.git.no-of-attempts` | `10` | When using the-SCM based approach, you can customize the number of retries to push the stubs to Git.
|`spring.cloud.contract.stubrunner.properties.git.username` | | When using the SCM-based approach, you can pass the username to connect to the git repository.
|`spring.cloud.contract.stubrunner.properties.git.password` | | When using the SCM-based approach, you can pass the password to connect to the git repository.
|`spring.cloud.contract.stubrunner.properties.git.wait-between-attempts` | `1000` | When using the SCM-based approach, you can customize waiting time in ms between attempts to push the stubs to git.
|`spring.cloud.contract.stubrunner.properties.git.ensure-git-suffix` | `true` | When using the SCM based approach, you can prevent stubrunner from adding `.git` to the repository URL by setting this property to `false`. This adds compatibility with git repositories which do not support such URLs, for example Azure DevOps.

|`stubrunner.properties.stubs.find-producer` | `false` | When using the `stubs` protocol, you can toggle this flag to search for contracts in the `group id / artifact id` instead of taking the stubs directly from the provided folder.
|`spring.cloud.contract.stubrunner.properties.stubs.find-producer` | `false` | When using the `stubs` protocol, you can toggle this flag to search for contracts in the `group id / artifact id` instead of taking the stubs directly from the provided folder.

|===
20 changes: 10 additions & 10 deletions docs/modules/ROOT/pages/customization/pluggable-architecture.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -183,45 +183,45 @@ properties:
|
* `git.branch` (plugin prop)

* `stubrunner.properties.git.branch` (system prop)
* `spring.cloud.contract.stubrunner.properties.git.branch` (system prop)

* `STUBRUNNER_PROPERTIES_GIT_BRANCH` (env prop)
* `SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_GIT_BRANCH` (env prop)
|master
|Which branch to checkout

|
* `git.username` (plugin prop)

* `stubrunner.properties.git.username` (system prop)
* `spring.cloud.contract.stubrunner.properties.git.username` (system prop)

* `STUBRUNNER_PROPERTIES_GIT_USERNAME` (env prop)
* `SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_GIT_USERNAME` (env prop)
|
|Git clone username

|
* `git.password` (plugin prop)

* `stubrunner.properties.git.password` (system prop)
* `spring.cloud.contract.stubrunner.properties.git.password` (system prop)

* `STUBRUNNER_PROPERTIES_GIT_PASSWORD` (env prop)
* `SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_GIT_PASSWORD` (env prop)
|
|Git clone password

|
* `git.no-of-attempts` (plugin prop)

* `stubrunner.properties.git.no-of-attempts` (system prop)
* `spring.cloud.contract.stubrunner.properties.git.no-of-attempts` (system prop)

* `STUBRUNNER_PROPERTIES_GIT_NO_OF_ATTEMPTS` (env prop)
* `SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_GIT_NO_OF_ATTEMPTS` (env prop)
|10
|Number of attempts to push the commits to `origin`

|
* `git.wait-between-attempts` (Plugin prop)

* `stubrunner.properties.git.wait-between-attempts` (system prop)
* `spring.cloud.contract.stubrunner.properties.git.wait-between-attempts` (system prop)

* `STUBRUNNER_PROPERTIES_GIT_WAIT_BETWEEN_ATTEMPTS` (env prop)
* `SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_GIT_WAIT_BETWEEN_ATTEMPTS` (env prop)
|1000
|Number of milliseconds to wait between attempts to push the commits to `origin`
|===
22 changes: 11 additions & 11 deletions docs/modules/ROOT/pages/docker-project.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ You can run the docker image and pass any of the xref:project-features-stubrunne
as environment variables. The convention is that all the
letters should be upper case.
The dot (`.`) should be replaced with underscore (`_`) characters. For example,
the `stubrunner.repositoryRoot` property should be represented
as a `STUBRUNNER_REPOSITORY_ROOT` environment variable.
the `spring.cloud.contract.stubrunner.repositoryRoot` property should be represented
as a `SPRING_COUD_CONTRACT_STUBRUNNER_REPOSITORY_ROOT` environment variable.

In addition to those variables you can set the following ones:

Expand Down Expand Up @@ -422,15 +422,15 @@ $ SC_CONTRACT_DOCKER_VERSION="..."
# The IP at which the app is running and Docker container can reach it
$ APP_IP="192.168.0.100"
# Spring Cloud Contract Stub Runner properties
$ STUBRUNNER_PORT="8083"
$ SPRING_CLOUD_CONTRACT_STUBRUNNER_PORT="8083"
# Stub coordinates 'groupId:artifactId:version:classifier:port'
$ STUBRUNNER_IDS="com.example:bookstore:0.0.1.RELEASE:stubs:9876"
$ STUBRUNNER_REPOSITORY_ROOT="http://${APP_IP}:8081/artifactory/libs-release-local"
$ SPRING_CLOUD_CONTRACT_STUBRUNNER_IDS="com.example:bookstore:0.0.1.RELEASE:stubs:9876"
$ SPRING_CLOUD_CONTRACT_STUBRUNNER_REPOSITORY_ROOT="http://${APP_IP}:8081/artifactory/libs-release-local"
# Run the docker with Stub Runner Boot
$ docker run --rm \
-e "STUBRUNNER_IDS=${STUBRUNNER_IDS}" \
-e "STUBRUNNER_REPOSITORY_ROOT=${STUBRUNNER_REPOSITORY_ROOT}" \
-e "STUBRUNNER_STUBS_MODE=REMOTE" \
-e "SPRING_CLOUD_CONTRACT_STUBRUNNER_IDS=${STUBRUNNER_IDS}" \
-e "SPRING_CLOUD_CONTRACT_STUBRUNNER_REPOSITORY_ROOT=${STUBRUNNER_REPOSITORY_ROOT}" \
-e "SPRING_CLOUD_CONTRACT_STUBRUNNER_STUBS_MODE=REMOTE" \
-p "${STUBRUNNER_PORT}:${STUBRUNNER_PORT}" \
-p "9876:9876" \
springcloud/spring-cloud-contract-stub-runner:"${SC_CONTRACT_DOCKER_VERSION}"
Expand Down Expand Up @@ -572,10 +572,10 @@ Example of usage
```bash
$ docker run \
-e "CAMEL_COMPONENT_RABBITMQ_ADDRESSES=172.18.0.1:5672" \ <1>
-e "STUBRUNNER_IDS=group:application:0.0.1-SNAPSHOT" \ <2>
-e "STUBRUNNER_REPOSITORY_ROOT=git://https://github.com/marcingrzejszczak/cdct_python_contracts.git" \ <3>
-e "SPRING_CLOUD_CONTRACT_STUBRUNNER_IDS=group:application:0.0.1-SNAPSHOT" \ <2>
-e "SPRING_CLOUD_CONTRACT_STUBRUNNER_REPOSITORY_ROOT=git://https://github.com/marcingrzejszczak/cdct_python_contracts.git" \ <3>
-e ADDITIONAL_OPTS="--thin.properties.dependencies.rabbitmq=org.apache.camel.springboot:camel-rabbitmq-starter:3.4.0" \ <4>
-e "STUBRUNNER_STUBS_MODE=REMOTE" \ <5>
-e "SPRING_CLOUD_CONTRACT_STUBRUNNER_STUBS_MODE=REMOTE" \ <5>
-v "${HOME}/.m2/:/home/scc/.m2:rw" \ <6>
-p 8750:8750 \ <7>
springcloud/spring-cloud-contract-stub-runner:3.0.4-SNAPSHOT <8>
Expand Down
10 changes: 5 additions & 5 deletions docs/modules/ROOT/pages/project-features-messaging.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ a stub. Then it is parsed on the consumer side, and proper stubbed routes are cr
IMPORTANT: If you have multiple frameworks on the classpath, Stub Runner needs to
define which one should be used. Assume that you have AMQP, Spring Cloud Stream, and Spring Integration
on the classpath and that you want to use Spring AMQP. Then you need to set
`stubrunner.stream.enabled=false` and `stubrunner.integration.enabled=false`.
`spring.cloud.contract.stubrunner.stream.enabled=false` and `spring.cloud.contract.stubrunner.integration.enabled=false`.
That way, the only remaining framework is Spring AMQP.

[[features-messaging-stub-triggering]]
Expand Down Expand Up @@ -277,7 +277,7 @@ Remember to annotate your test class with `@AutoConfigureStubRunner`.
[[features-messaging-stub-runner-camel-disabling]]
=== Disabling the Functionality

If you need to disable this functionality, set the `stubrunner.camel.enabled=false` property.
If you need to disable this functionality, set the `spring.cloud.contract.stubrunner.camel.enabled=false` property.

[[features-messaging-stub-runner-camel-example]]
=== Examples
Expand Down Expand Up @@ -357,7 +357,7 @@ classpath. Remember to annotate your test class with `@AutoConfigureStubRunner`.
=== Disabling the Functionality

If you need to disable this functionality, set the
`stubrunner.integration.enabled=false` property.
`spring.cloud.contract.stubrunner.integration.enabled=false` property.

[[features-messaging-stub-runner-integration-example]]
=== Examples
Expand Down Expand Up @@ -471,7 +471,7 @@ classpath. Remember to annotate your test class with `@AutoConfigureStubRunner`.
[[features-messaging-stub-runner-stream-disabling]]
=== Disabling the Functionality

If you need to disable this functionality, set the `stubrunner.stream.enabled=false`
If you need to disable this functionality, set the `spring.cloud.contract.stubrunner.stream.enabled=false`
property.

[[features-messaging-stub-runner-stream-example]]
Expand Down Expand Up @@ -588,7 +588,7 @@ Further assume the following test configuration:
====
[source,yml,indent=0]
----
stubrunner:
spring.cloud.contract.stubrunner:
repository-root: stubs:classpath:/stubs/
ids: my:stubs
stubs-mode: remote
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ by running the following commands:
[source,bash,indent=0]
----
$ wget -O stub-runner.jar 'https://search.maven.org/remotecontent?filepath=org/springframework/cloud/spring-cloud-contract-stub-runner-boot/2.0.1.RELEASE/spring-cloud-contract-stub-runner-boot-2.0.1.RELEASE.jar'
$ java -jar stub-runner.jar --stubrunner.ids=... --stubrunner.repositoryRoot=...
$ java -jar stub-runner.jar --spring.cloud.contract.stubrunner.ids=... --spring.cloud.contract.stubrunner.repositoryRoot=...
----
====

Expand All @@ -54,7 +54,7 @@ $ java -jar stub-runner.jar --stubrunner.ids=... --stubrunner.repositoryRoot=...
Starting from the `1.4.0.RELEASE` version of the https://cloud.spring.io/spring-cloud-cli[Spring Cloud CLI]
project, you can start Stub Runner Boot by running `spring cloud stubrunner`.

To pass the configuration, you can create a `stubrunner.yml` file in the current working directory,
To pass the configuration, you can create a `spring.cloud.contract.stubrunner.yml` file in the current working directory,
in a subdirectory called `config`, or in `~/.spring-cloud`. The file could resemble the following
example for running stubs installed locally:

Expand All @@ -63,7 +63,7 @@ example for running stubs installed locally:
====
[source,yml,indent=0]
----
stubrunner:
spring.cloud.contract.stubrunner:
stubsMode: LOCAL
ids:
- com.example:beer-api-producer:+:9876
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ in a static block such as the following example (for Eureka):
[[features-stub-runner-additional-config]]
== Additional Configuration

You can match the `artifactId` of the stub with the name of your application by using the `stubrunner.idsToServiceIds:` map.
You can match the `artifactId` of the stub with the name of your application by using the `spring.cloud.contract.stubrunner.idsToServiceIds:` map.

TIP: By default, all service discovery is stubbed. This means that, regardless of whether you have
an existing `DiscoveryClient`, its results are ignored. However, if you want to reuse it, you can set
`stubrunner.cloud.delegate.enabled` to `true`, and then your existing `DiscoveryClient` results are
`spring.cloud.contract.stubrunner.cloud.delegate.enabled` to `true`, and then your existing `DiscoveryClient` results are
merged with the stubbed ones.

The default Maven configuration used by Stub Runner can be tweaked either
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ properties. The following table shows their names with their default values:
[frame="topbot",options="header"]
|===============
| Property name | Default value | Description
|`stubrunner.minPort`|`10000`| Minimum value of a port for a started WireMock with stubs.
|`stubrunner.maxPort`|`15000`| Maximum value of a port for a started WireMock with stubs.
|`stubrunner.repositoryRoot`|| Maven repository URL. If blank, then call the local Maven repo.
|`stubrunner.classifier`|`stubs`| Default classifier for the stub artifacts.
|`stubrunner.stubsMode`|`CLASSPATH`| The way you want to fetch and register the stubs.
|`stubrunner.ids`|| Array of Ivy notation stubs to download.
|`stubrunner.username`|| Optional username to access the tool that stores the JARs with
|`spring.cloud.contract.stubrunner.minPort`|`10000`| Minimum value of a port for a started WireMock with stubs.
|`spring.cloud.contract.stubrunner.maxPort`|`15000`| Maximum value of a port for a started WireMock with stubs.
|`spring.cloud.contract.stubrunner.repositoryRoot`|| Maven repository URL. If blank, then call the local Maven repo.
|`spring.cloud.contract.stubrunner.classifier`|`stubs`| Default classifier for the stub artifacts.
|`spring.cloud.contract.stubrunner.stubsMode`|`CLASSPATH`| The way you want to fetch and register the stubs.
|`spring.cloud.contract.stubrunner.ids`|| Array of Ivy notation stubs to download.
|`spring.cloud.contract.stubrunner.username`|| Optional username to access the tool that stores the JARs with
stubs.
|`stubrunner.password`|| Optional password to access the tool that stores the JARs with
|`spring.cloud.contract.stubrunner.password`|| Optional password to access the tool that stores the JARs with
stubs.
|`stubrunner.stubsPerConsumer`|`false`| Set to `true` if you want to use different stubs for
|`spring.cloud.contract.stubrunner.stubsPerConsumer`|`false`| Set to `true` if you want to use different stubs for
each consumer instead of registering all stubs for every consumer.
|`stubrunner.consumerName`|| If you want to use a stub for each consumer and want to
|`spring.cloud.contract.stubrunner.consumerName`|| If you want to use a stub for each consumer and want to
override the consumer name, change this value.
|===============

[[features-stub-runner-stub-runner-stub-ids]]
== Stub Runner Stubs IDs

You can set the stubs to download in the `stubrunner.ids` system property. They
You can set the stubs to download in the `spring.cloud.contract.stubrunner.ids` system property. They
use the following pattern:

====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ As a consumer, you might not want to wait for the producer to finish its impleme

As a producer, when a contract is defined, you are required to make the generated tests pass in order for the stubs to be published. There are cases where you would like to unblock the consumers so that they can fetch the stubs before your tests actually pass. In this case, you should set such contracts as in-progress. You can read more about this under the xref:project-features-contract/common-top-elements.adoc#contract-dsl-in-progress[Contracts in Progress] section. That way, your tests are not generated, but the stubs are generated.

As a consumer, you can toggle a switch to generate stubs at runtime. Stub Runner ignores all the existing stub mappings and generates new ones for all the contract definitions. Another option is to pass the `stubrunner.generate-stubs` system property. The following example shows such a setup:
As a consumer, you can toggle a switch to generate stubs at runtime. Stub Runner ignores all the existing stub mappings and generates new ones for all the contract definitions. Another option is to pass the `spring.cloud.contract.stubrunner.generate-stubs` system property. The following example shows such a setup:

====
[source,java,indent=0,subs="verbatim",role="primary"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ Stub Runner Spring registers environment variables in the following manner
for every registered WireMock server. The following example shows Stub Runner IDs for
`com.example:thing1` and `com.example:thing2`:

- `stubrunner.runningstubs.thing1.port`
- `stubrunner.runningstubs.com.example.thing1.port`
- `stubrunner.runningstubs.thing2.port`
- `stubrunner.runningstubs.com.example.thing2.port`
- `spring.cloud.contract.stubrunner.runningstubs.thing1.port`
- `spring.cloud.contract.stubrunner.runningstubs.com.example.thing1.port`
- `spring.cloud.contract.stubrunner.runningstubs.thing2.port`
- `spring.cloud.contract.stubrunner.runningstubs.com.example.thing2.port`

You can reference these values in your code.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You cannot produce two different responses for the same request. That is why you
contracts and then profit from the `stubsPerConsumer` feature.

On the producer side, the consumers can have a folder that contains contracts related only to them.
By setting the `stubrunner.stubs-per-consumer` flag to `true`, we no longer register all stubs but only those that
By setting the `spring.cloud.contract.stubrunner.stubs-per-consumer` flag to `true`, we no longer register all stubs but only those that
correspond to the consumer application's name. In other words, we scan the path of every stub and,
if it contains a subfolder with name of the consumer in the path, only then is it registered.

Expand All @@ -66,7 +66,7 @@ On the `foo` producer side the contracts would look like this
└── shouldCallFoo.groovy
----

The `bar-consumer` consumer can either set the `spring.application.name` or the `stubrunner.consumer-name` to `bar-consumer`
The `bar-consumer` consumer can either set the `spring.application.name` or the `spring.cloud.contract.stubrunner.consumer-name` to `bar-consumer`
Alternatively, you can set the test as follows:

====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ stubsMode = StubRunnerProperties.StubsMode.REMOTE,
----
====

Contracts and stubs may be stored in a location, where each producer has its own, dedicated folder for contracts and stub mappings. Under that folder, each consumer can have its own setup. To make Stub Runner find the dedicated folder from the provided IDs, you can pass the `stubs.find-producer=true` property or the `stubrunner.stubs.find-producer=true` system property.
Contracts and stubs may be stored in a location, where each producer has its own, dedicated folder for contracts and stub mappings. Under that folder, each consumer can have its own setup. To make Stub Runner find the dedicated folder from the provided IDs, you can pass the `stubs.find-producer=true` property or the `spring.cloud.contract.stubrunner.stubs.find-producer=true` system property.
The following listing shows an arrangement of contracts and stubs:

====
Expand Down
Loading
Loading