diff --git a/docs/modules/ROOT/pages/_additional-stubrunner-configprops.adoc b/docs/modules/ROOT/pages/_additional-stubrunner-configprops.adoc index cf35b933e8..95c2fe885a 100644 --- a/docs/modules/ROOT/pages/_additional-stubrunner-configprops.adoc +++ b/docs/modules/ROOT/pages/_additional-stubrunner-configprops.adoc @@ -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. |=== diff --git a/docs/modules/ROOT/pages/customization/pluggable-architecture.adoc b/docs/modules/ROOT/pages/customization/pluggable-architecture.adoc index 538170e221..09cc5ac664 100644 --- a/docs/modules/ROOT/pages/customization/pluggable-architecture.adoc +++ b/docs/modules/ROOT/pages/customization/pluggable-architecture.adoc @@ -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` |=== diff --git a/docs/modules/ROOT/pages/docker-project.adoc b/docs/modules/ROOT/pages/docker-project.adoc index 2549f2d10b..966b1ad52f 100644 --- a/docs/modules/ROOT/pages/docker-project.adoc +++ b/docs/modules/ROOT/pages/docker-project.adoc @@ -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: @@ -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}" @@ -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> diff --git a/docs/modules/ROOT/pages/project-features-messaging.adoc b/docs/modules/ROOT/pages/project-features-messaging.adoc index 031f8180ae..02bd62cedb 100644 --- a/docs/modules/ROOT/pages/project-features-messaging.adoc +++ b/docs/modules/ROOT/pages/project-features-messaging.adoc @@ -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]] @@ -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 @@ -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 @@ -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]] @@ -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 diff --git a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-boot.adoc b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-boot.adoc index 92b4766845..6b8676554f 100644 --- a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-boot.adoc +++ b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-boot.adoc @@ -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=... ---- ==== @@ -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: @@ -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 diff --git a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-cloud.adoc b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-cloud.adoc index 10457f5dea..27da6c3b41 100644 --- a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-cloud.adoc +++ b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-cloud.adoc @@ -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 diff --git a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-common.adoc b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-common.adoc index 10ccc3c817..2b34aad1fc 100644 --- a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-common.adoc +++ b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-common.adoc @@ -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: ==== diff --git a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-generate-stubs-at-runtime.adoc b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-generate-stubs-at-runtime.adoc index 5c2b57bb1b..de49e85198 100644 --- a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-generate-stubs-at-runtime.adoc +++ b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-generate-stubs-at-runtime.adoc @@ -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"] diff --git a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-junit.adoc b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-junit.adoc index 7c030137fb..86ca27b1a8 100644 --- a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-junit.adoc +++ b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-junit.adoc @@ -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. diff --git a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-stubs-per-consumer.adoc b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-stubs-per-consumer.adoc index 0c04c690dc..6b5b409a38 100644 --- a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-stubs-per-consumer.adoc +++ b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-stubs-per-consumer.adoc @@ -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. @@ -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: ==== diff --git a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-stubs-protocol.adoc b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-stubs-protocol.adoc index 50a0e2c0e4..3031f7b8b8 100644 --- a/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-stubs-protocol.adoc +++ b/docs/modules/ROOT/pages/project-features-stubrunner/stub-runner-stubs-protocol.adoc @@ -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: ==== diff --git a/docs/modules/ROOT/partials/_configprops.adoc b/docs/modules/ROOT/partials/_configprops.adoc index af43ade08a..9d9d5c565e 100644 --- a/docs/modules/ROOT/partials/_configprops.adoc +++ b/docs/modules/ROOT/partials/_configprops.adoc @@ -26,7 +26,7 @@ |stubrunner.max-port | `+++15000+++` | Max value of a port for the automatically started WireMock server. |stubrunner.min-port | `+++10000+++` | Min value of a port for the automatically started WireMock server. |stubrunner.password | | Repository password. -|stubrunner.properties | | Map of properties that can be passed to custom {@link org.springframework.cloud.contract.stubrunner.StubDownloaderBuilder}. +|spring.cloud.contract.stubrunner.properties | | Map of properties that can be passed to custom {@link org.springframework.cloud.contract.stubrunner.StubDownloaderBuilder}. |stubrunner.proxy-host | | Repository proxy host. |stubrunner.proxy-port | | Repository proxy port. |stubrunner.server-id | | diff --git a/docs/src/main/asciidoc/sagan-boot.adoc b/docs/src/main/asciidoc/sagan-boot.adoc index b42debcca8..91b0281562 100644 --- a/docs/src/main/asciidoc/sagan-boot.adoc +++ b/docs/src/main/asciidoc/sagan-boot.adoc @@ -85,7 +85,7 @@ The tests are being skipped because the producer-side contract implementation is By getting already-existing producer service stubs from a remote repository. To do so, pass the stub artifact IDs and artifact repository URL as Spring Cloud Contract Stub Runner properties, as the following example shows: ```yml - stubrunner: + spring.cloud.contract.stubrunner: ids: 'com.example:http-server-dsl:+:stubs:8080' repositoryRoot: https://repo.spring.io/libs-snapshot ``` diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptions.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptions.java index be81691e8c..ba758e8c48 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptions.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptions.java @@ -171,33 +171,40 @@ public class StubRunnerOptions { public static StubRunnerOptions fromSystemProps() { StubRunnerOptionsBuilder builder = new StubRunnerOptionsBuilder() - .withMinPort(Integer.valueOf(System.getProperty("stubrunner.port.range.min", "10000"))) - .withMaxPort(Integer.valueOf(System.getProperty("stubrunner.port.range.max", "15000"))) - .withStubRepositoryRoot(ResourceResolver.resource(System.getProperty("stubrunner.repository.root", ""))) - .withStubsMode(System.getProperty("stubrunner.stubs-mode", "LOCAL")) - .withStubsClassifier(System.getProperty("stubrunner.classifier", "stubs")) - .withStubs(System.getProperty("stubrunner.ids", "")) - .withUsername(System.getProperty("stubrunner.username")) - .withPassword(System.getProperty("stubrunner.password")) - .withStubPerConsumer(Boolean.parseBoolean(System.getProperty("stubrunner.stubs-per-consumer", "false"))) - .withConsumerName(System.getProperty("stubrunner.consumer-name")) - .withMappingsOutputFolder(System.getProperty("stubrunner.mappings-output-folder")) - .withDeleteStubsAfterTest( - Boolean.parseBoolean(System.getProperty("stubrunner.delete-stubs-after-test", "true"))) - .withGenerateStubs(Boolean.parseBoolean(System.getProperty("stubrunner.generate-stubs", "false"))) - .withFailOnNoStubs(Boolean.parseBoolean(System.getProperty("stubrunner.fail-on-no-stubs", "false"))) + .withMinPort( + Integer.valueOf(System.getProperty("spring.cloud.contract.stubrunner.port.range.min", "10000"))) + .withMaxPort( + Integer.valueOf(System.getProperty("spring.cloud.contract.stubrunner.port.range.max", "15000"))) + .withStubRepositoryRoot(ResourceResolver + .resource(System.getProperty("spring.cloud.contract.stubrunner.repository.root", ""))) + .withStubsMode(System.getProperty("spring.cloud.contract.stubrunner.stubs-mode", "LOCAL")) + .withStubsClassifier(System.getProperty("spring.cloud.contract.stubrunner.classifier", "stubs")) + .withStubs(System.getProperty("spring.cloud.contract.stubrunner.ids", "")) + .withUsername(System.getProperty("spring.cloud.contract.stubrunner.username")) + .withPassword(System.getProperty("spring.cloud.contract.stubrunner.password")) + .withStubPerConsumer(Boolean + .parseBoolean(System.getProperty("spring.cloud.contract.stubrunner.stubs-per-consumer", "false"))) + .withConsumerName(System.getProperty("spring.cloud.contract.stubrunner.consumer-name")) + .withMappingsOutputFolder(System.getProperty("spring.cloud.contract.stubrunner.mappings-output-folder")) + .withDeleteStubsAfterTest(Boolean + .parseBoolean(System.getProperty("spring.cloud.contract.stubrunner.delete-stubs-after-test", "true"))) + .withGenerateStubs(Boolean + .parseBoolean(System.getProperty("spring.cloud.contract.stubrunner.generate-stubs", "false"))) + .withFailOnNoStubs(Boolean + .parseBoolean(System.getProperty("spring.cloud.contract.stubrunner.fail-on-no-stubs", "false"))) .withProperties(stubRunnerProps()) - .withServerId(System.getProperty("stubrunner.server-id", "")); + .withServerId(System.getProperty("spring.cloud.contract.stubrunner.server-id", "")); builder = httpStubConfigurer(builder); - String proxyHost = System.getProperty("stubrunner.proxy.host"); + String proxyHost = System.getProperty("spring.cloud.contract.stubrunner.proxy.host"); if (proxyHost != null) { - builder.withProxy(proxyHost, Integer.parseInt(System.getProperty("stubrunner.proxy.port"))); + builder.withProxy(proxyHost, + Integer.parseInt(System.getProperty("spring.cloud.contract.stubrunner.proxy.port"))); } return builder.build(); } private static StubRunnerOptionsBuilder httpStubConfigurer(StubRunnerOptionsBuilder builder) { - String classProperty = System.getProperty("stubrunner.http-server-stub-configurer", + String classProperty = System.getProperty("spring.cloud.contract.stubrunner.http-server-stub-configurer", HttpServerStubConfigurer.NoOpHttpServerStubConfigurer.class.getName()); try { Class clazz = Class.forName(classProperty); @@ -213,10 +220,11 @@ private static Map stubRunnerProps() { Properties properties = System.getProperties(); Set propertyNames = properties.stringPropertyNames(); propertyNames.stream() - // stubrunner.properties.foo.bar=baz - .filter(s -> s.toLowerCase(Locale.ROOT).startsWith("stubrunner.properties")) + // spring.cloud.contract.stubrunner.properties.foo.bar=baz + .filter(s -> s.toLowerCase(Locale.ROOT).startsWith("spring.cloud.contract.stubrunner.properties")) // foo.bar=baz - .forEach(s -> map.put(s.substring("stubrunner.properties".length() + 1), System.getProperty(s))); + .forEach(s -> map.put(s.substring("spring.cloud.contract.stubrunner.properties".length() + 1), + System.getProperty(s))); return map; } diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerPropertyUtils.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerPropertyUtils.java index 7bf76683d5..b8931f4114 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerPropertyUtils.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerPropertyUtils.java @@ -35,7 +35,7 @@ public final class StubRunnerPropertyUtils { private static final Log log = LogFactory.getLog(StubRunnerPropertyUtils.class); - private static final String STUBRUNNER_PROPERTIES = "stubrunner.properties"; + private static final String STUBRUNNER_PROPERTIES = "spring.cloud.contract.stubrunner.properties"; static PropertyFetcher FETCHER = new PropertyFetcher(); @@ -82,7 +82,7 @@ public static String getProperty(Map options, String propName) { } private static String appendPrefixIfNecessary(String prop) { - if (prop.toLowerCase(Locale.ROOT).startsWith("stubrunner")) { + if (prop.toLowerCase(Locale.ROOT).startsWith("spring.cloud.contract.stubrunner")) { return prop; } return STUBRUNNER_PROPERTIES + "." + prop; diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/server/StubRunnerServerConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/server/StubRunnerServerConfiguration.java index dab7d44674..921d963035 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/server/StubRunnerServerConfiguration.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/server/StubRunnerServerConfiguration.java @@ -28,7 +28,8 @@ @Configuration(proxyBeanMethods = false) class StubRunnerServerConfiguration { - @ConditionalOnProperty(name = "stubrunner.messaging.enabled", havingValue = "true", matchIfMissing = true) + @ConditionalOnProperty(name = "spring.cloud.contract.stubrunner.messaging.enabled", havingValue = "true", + matchIfMissing = true) @AutoConfigureMessageVerifier @Import({ TriggerController.class }) static class StubRunnerMessagingAutoConfiguration { diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/AutoConfigureStubRunner.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/AutoConfigureStubRunner.java index e1cecd3045..5a39cafcb0 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/AutoConfigureStubRunner.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/AutoConfigureStubRunner.java @@ -38,7 +38,7 @@ @Documented @ImportAutoConfiguration @AutoConfigureMessageVerifier -@PropertyMapping(value = "stubrunner", skip = SkipPropertyMapping.ON_DEFAULT_VALUE) +@PropertyMapping(value = "spring.cloud.contract.stubrunner", skip = SkipPropertyMapping.ON_DEFAULT_VALUE) public @interface AutoConfigureStubRunner { /** diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.java index 9cd2a18f67..b3ad14cccf 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.java @@ -59,7 +59,7 @@ @Import(StubRunnerPortBeanPostProcessor.class) public class StubRunnerConfiguration { - static final String STUBRUNNER_PREFIX = "stubrunner.runningstubs"; + static final String STUBRUNNER_PREFIX = "spring.cloud.contract.stubrunner.runningstubs"; private StubDownloaderBuilderProvider provider = new StubDownloaderBuilderProvider(); diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/StubRunnerProperties.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/StubRunnerProperties.java index 5659735060..526fd971cf 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/StubRunnerProperties.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/StubRunnerProperties.java @@ -31,7 +31,7 @@ /** * @author Dave Syer */ -@ConfigurationProperties("stubrunner") +@ConfigurationProperties("spring.cloud.contract.stubrunner") public class StubRunnerProperties { /** diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/ConditionalOnStubbedDiscoveryDisabled.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/ConditionalOnStubbedDiscoveryDisabled.java index 0c5bd2aed1..981477fc48 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/ConditionalOnStubbedDiscoveryDisabled.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/ConditionalOnStubbedDiscoveryDisabled.java @@ -33,7 +33,8 @@ @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE, ElementType.METHOD }) @Documented -@ConditionalOnProperty(value = "stubrunner.cloud.stubbed.discovery.enabled", havingValue = "false") +@ConditionalOnProperty(value = "spring.cloud.contract.stubrunner.cloud.stubbed.discovery.enabled", + havingValue = "false") public @interface ConditionalOnStubbedDiscoveryDisabled { } diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/ConditionalOnStubbedDiscoveryEnabled.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/ConditionalOnStubbedDiscoveryEnabled.java index bf93ac50fc..a44f009b5a 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/ConditionalOnStubbedDiscoveryEnabled.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/ConditionalOnStubbedDiscoveryEnabled.java @@ -34,7 +34,7 @@ @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE, ElementType.METHOD }) @Documented -@ConditionalOnProperty(value = "stubrunner.cloud.stubbed.discovery.enabled", havingValue = "true", +@ConditionalOnProperty(value = "spring.cloud.contract.stubrunner.cloud.stubbed.discovery.enabled", havingValue = "true", matchIfMissing = true) public @interface ConditionalOnStubbedDiscoveryEnabled { diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubMapperProperties.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubMapperProperties.java index 7b85401c18..1934966496 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubMapperProperties.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubMapperProperties.java @@ -36,7 +36,7 @@ * @author Marcin Grzejszczak * @since 1.0.0 */ -@ConfigurationProperties("stubrunner") +@ConfigurationProperties("spring.cloud.contract.stubrunner") public class StubMapperProperties { /** diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfiguration.java index 7a1ef11f28..3a4fc6a640 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfiguration.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfiguration.java @@ -41,7 +41,7 @@ @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties(StubMapperProperties.class) @ConditionalOnClass(DiscoveryClient.class) -@ConditionalOnProperty(value = "stubrunner.cloud.enabled", matchIfMissing = true) +@ConditionalOnProperty(value = "spring.cloud.contract.stubrunner.cloud.enabled", matchIfMissing = true) public class StubRunnerSpringCloudAutoConfiguration { @Bean @@ -51,7 +51,8 @@ public StubRunnerDiscoveryClientWrapper stubRunnerDiscoveryClientWrapper(BeanFac @Bean @ConditionalOnStubbedDiscoveryEnabled - @ConditionalOnProperty(value = "stubrunner.cloud.delegate.enabled", havingValue = "false", matchIfMissing = true) + @ConditionalOnProperty(value = "spring.cloud.contract.stubrunner.cloud.delegate.enabled", havingValue = "false", + matchIfMissing = true) @Order(Ordered.HIGHEST_PRECEDENCE) public DiscoveryClient noOpStubRunnerDiscoveryClient(StubFinder stubFinder, StubMapperProperties stubMapperProperties) { @@ -60,7 +61,8 @@ public DiscoveryClient noOpStubRunnerDiscoveryClient(StubFinder stubFinder, @Bean @ConditionalOnStubbedDiscoveryEnabled - @ConditionalOnProperty(value = "stubrunner.cloud.delegate.enabled", havingValue = "false", matchIfMissing = true) + @ConditionalOnProperty(value = "spring.cloud.contract.stubrunner.cloud.delegate.enabled", havingValue = "false", + matchIfMissing = true) @Order(Ordered.HIGHEST_PRECEDENCE) public ReactiveDiscoveryClient noOpStubRunnerReactiveDiscoveryClient(StubFinder stubFinder, StubMapperProperties stubMapperProperties) { @@ -123,7 +125,7 @@ StubMapperProperties stubMapperProperties() { boolean isStubbedDiscoveryEnabled() { if (this.stubbedDiscoveryEnabled == null) { this.stubbedDiscoveryEnabled = Boolean.valueOf(this.beanFactory.getBean(Environment.class) - .getProperty("stubrunner.cloud.stubbed.discovery.enabled", "true")); + .getProperty("spring.cloud.contract.stubrunner.cloud.stubbed.discovery.enabled", "true")); } return this.stubbedDiscoveryEnabled; } @@ -131,7 +133,7 @@ boolean isStubbedDiscoveryEnabled() { boolean isCloudDelegateEnabled() { if (this.cloudDelegateEnabled == null) { this.cloudDelegateEnabled = Boolean.valueOf(this.beanFactory.getBean(Environment.class) - .getProperty("stubrunner.cloud.delegate.enabled", "false")); + .getProperty("spring.cloud.contract.stubrunner.cloud.delegate.enabled", "false")); } return this.cloudDelegateEnabled; } diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfiguration.java index 6c87651b43..0e93edb17a 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfiguration.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfiguration.java @@ -42,7 +42,7 @@ @AutoConfigureAfter({ StubRunnerConfiguration.class, ConsulServiceRegistryAutoConfiguration.class }) @ConditionalOnClass(ConsulClient.class) @ConditionalOnStubbedDiscoveryDisabled -@ConditionalOnProperty(value = "stubrunner.cloud.consul.enabled", matchIfMissing = true) +@ConditionalOnProperty(value = "spring.cloud.contract.stubrunner.cloud.consul.enabled", matchIfMissing = true) public class StubRunnerSpringCloudConsulAutoConfiguration { @Bean(initMethod = "registerStubs") diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/eureka/StubRunnerSpringCloudEurekaAutoConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/eureka/StubRunnerSpringCloudEurekaAutoConfiguration.java index 4241f85efa..148e43c793 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/eureka/StubRunnerSpringCloudEurekaAutoConfiguration.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/eureka/StubRunnerSpringCloudEurekaAutoConfiguration.java @@ -55,7 +55,7 @@ @ConditionalOnClass(CloudEurekaClient.class) @ConditionalOnStubbedDiscoveryDisabled @ConditionalOnEurekaEnabled -@ConditionalOnProperty(value = "stubrunner.cloud.eureka.enabled", matchIfMissing = true) +@ConditionalOnProperty(value = "spring.cloud.contract.stubrunner.cloud.eureka.enabled", matchIfMissing = true) public class StubRunnerSpringCloudEurekaAutoConfiguration { @Profile("!cloud") diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/loadbalancer/SpringCloudLoadBalancerAutoConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/loadbalancer/SpringCloudLoadBalancerAutoConfiguration.java index 01c83c1763..418edc8506 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/loadbalancer/SpringCloudLoadBalancerAutoConfiguration.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/loadbalancer/SpringCloudLoadBalancerAutoConfiguration.java @@ -64,7 +64,7 @@ */ @Configuration(proxyBeanMethods = false) @ConditionalOnClass({ LoadBalancerClient.class, LoadBalancerClientFactory.class }) -@ConditionalOnProperty(value = "stubrunner.cloud.loadbalancer.enabled", matchIfMissing = true) +@ConditionalOnProperty(value = "spring.cloud.contract.stubrunner.cloud.loadbalancer.enabled", matchIfMissing = true) @ConditionalOnBean(StubMapperProperties.class) @AutoConfigureBefore(LoadBalancerAutoConfiguration.class) @AutoConfigureAfter({ LoadBalancerClientConfiguration.class, StubRunnerSpringCloudAutoConfiguration.class }) diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfiguration.java index 00bb5e1dc5..c9f1b9c9ca 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfiguration.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfiguration.java @@ -43,7 +43,7 @@ @ConditionalOnClass(org.apache.curator.x.discovery.ServiceInstance.class) @ConditionalOnStubbedDiscoveryDisabled @ConditionalOnZookeeperDiscoveryEnabled -@ConditionalOnProperty(value = "stubrunner.cloud.zookeeper.enabled", matchIfMissing = true) +@ConditionalOnProperty(value = "spring.cloud.contract.stubrunner.cloud.zookeeper.enabled", matchIfMissing = true) public class StubRunnerSpringCloudZookeeperAutoConfiguration { @Bean(initMethod = "registerStubs") diff --git a/spring-cloud-contract-stub-runner/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-contract-stub-runner/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 9130066f3f..2e56fce915 100644 --- a/spring-cloud-contract-stub-runner/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-contract-stub-runner/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,85 +1,85 @@ { "properties": [ { - "name": "stubrunner.amqp.enabled", + "name": "spring.cloud.contract.stubrunner.amqp.enabled", "type": "java.lang.Boolean", "description": "Whether to enable support for Stub Runner and AMQP.", "defaultValue": false }, { - "name": "stubrunner.amqp.mockCOnnection", + "name": "spring.cloud.contract.stubrunner.amqp.mockCOnnection", "type": "java.lang.Boolean", "description": "Whether to enable support for Stub Runner and AMQP mocked connection factory.", "defaultValue": true }, { - "name": "stubrunner.cloud.consul.enabled", + "name": "spring.cloud.contract.stubrunner.cloud.consul.enabled", "type": "java.lang.Boolean", "description": "Whether to enable stubs registration in Consul.", "defaultValue": true }, { - "name": "stubrunner.cloud.delegate.enabled", + "name": "spring.cloud.contract.stubrunner.cloud.delegate.enabled", "type": "java.lang.Boolean", "description": "Whether to enable DiscoveryClient's Stub Runner implementation.", "defaultValue": true }, { - "name": "stubrunner.cloud.enabled", + "name": "spring.cloud.contract.stubrunner.cloud.enabled", "type": "java.lang.Boolean", "description": "Whether to enable Spring Cloud support for Stub Runner.", "defaultValue": true }, { - "name": "stubrunner.cloud.eureka.enabled", + "name": "spring.cloud.contract.stubrunner.cloud.eureka.enabled", "type": "java.lang.Boolean", "description": "Whether to enable stubs registration in Eureka.", "defaultValue": true }, { - "name": "stubrunner.cloud.loadbalancer.enabled", + "name": "spring.cloud.contract.stubrunner.cloud.loadbalancer.enabled", "type": "java.lang.Boolean", "description": "Whether to enable Stub Runner's Spring Cloud Load Balancer integration.", "defaultValue": true }, { - "name": "stubrunner.cloud.stubbed.discovery.enabled", + "name": "spring.cloud.contract.stubrunner.cloud.stubbed.discovery.enabled", "type": "java.lang.Boolean", "description": "Whether Service Discovery should be stubbed for Stub Runner. If set to false, stubs will get registered in real service discovery.", "defaultValue": true }, { - "name": "stubrunner.cloud.zookeeper.enabled", + "name": "spring.cloud.contract.stubrunner.cloud.zookeeper.enabled", "type": "java.lang.Boolean", "description": "Whether to enable stubs registration in Zookeeper.", "defaultValue": true }, { - "name": "stubrunner.integration.enabled", + "name": "spring.cloud.contract.stubrunner.integration.enabled", "type": "java.lang.Boolean", "description": "Whether to enable Stub Runner integration with Spring Integration.", "defaultValue": true }, { - "name": "stubrunner.stream.enabled", + "name": "spring.cloud.contract.stubrunner.stream.enabled", "type": "java.lang.Boolean", "description": "Whether to enable Stub Runner integration with Spring Cloud Stream.", "defaultValue": true }, { - "name": "stubrunner.jms.enabled", + "name": "spring.cloud.contract.stubrunner.jms.enabled", "type": "java.lang.Boolean", "description": "Whether to enable Stub Runner integration with Spring JMS.", "defaultValue": true }, { - "name": "stubrunner.kafka.enabled", + "name": "spring.cloud.contract.stubrunner.kafka.enabled", "type": "java.lang.Boolean", "description": "Whether to enable Stub Runner integration with Spring Kafka.", "defaultValue": true }, { - "name": "stubrunner.kafka.initializer.enabled", + "name": "spring.cloud.contract.stubrunner.kafka.initializer.enabled", "type": "java.lang.Boolean", "description": "Whether to allow Stub Runner to take care of polling for messages instead of the KafkaStubMessages component. The latter should be used only on the producer side.", "defaultValue": true diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy index 0fee5fc38c..42055974de 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy @@ -277,26 +277,26 @@ class StubRunnerOptionsBuilderSpec extends Specification { @RestoreSystemProperties def shouldSetAllPropsFromSystemProps() { given: - System.setProperty("stubrunner.port.range.min", "1") - System.setProperty("stubrunner.port.range.max", "2") - System.setProperty("stubrunner.repository.root", "root") - System.setProperty("stubrunner.stubs-mode", "LOCAL") - System.setProperty("stubrunner.classifier", "classifier") - System.setProperty("stubrunner.ids", "a:b:c,foo:bar:baz:classifier") - System.setProperty("stubrunner.username", "foo") - System.setProperty("stubrunner.password", "bar") - System.setProperty("stubrunner.stubs-per-consumer", "true") - System.setProperty("stubrunner.consumer-name", "consumer") - System.setProperty("stubrunner.proxy.host", "host") - System.setProperty("stubrunner.proxy.port", "4") - System.setProperty("stubrunner.mappings-output-folder", "folder") - System.setProperty("stubrunner.properties.foo-bar", "bar") - System.setProperty("stubrunner.properties.foo-baz", "baz") - System.setProperty("stubrunner.properties.bar.bar", "foo") - System.setProperty("stubrunner.delete-stubs-after-test", "false") - System.setProperty("stubrunner.generate-stubs", "true") - System.setProperty("stubrunner.fail-on-no-stubs", "false") - System.setProperty("stubrunner.http-server-stub-configurer", "org.springframework.cloud.contract.stubrunner.Foo") + System.setProperty("spring.cloud.contract.stubrunner.port.range.min", "1") + System.setProperty("spring.cloud.contract.stubrunner.port.range.max", "2") + System.setProperty("spring.cloud.contract.stubrunner.repository.root", "root") + System.setProperty("spring.cloud.contract.stubrunner.stubs-mode", "LOCAL") + System.setProperty("spring.cloud.contract.stubrunner.classifier", "classifier") + System.setProperty("spring.cloud.contract.stubrunner.ids", "a:b:c,foo:bar:baz:classifier") + System.setProperty("spring.cloud.contract.stubrunner.username", "foo") + System.setProperty("spring.cloud.contract.stubrunner.password", "bar") + System.setProperty("spring.cloud.contract.stubrunner.stubs-per-consumer", "true") + System.setProperty("spring.cloud.contract.stubrunner.consumer-name", "consumer") + System.setProperty("spring.cloud.contract.stubrunner.proxy.host", "host") + System.setProperty("spring.cloud.contract.stubrunner.proxy.port", "4") + System.setProperty("spring.cloud.contract.stubrunner.mappings-output-folder", "folder") + System.setProperty("spring.cloud.contract.stubrunner.properties.foo-bar", "bar") + System.setProperty("spring.cloud.contract.stubrunner.properties.foo-baz", "baz") + System.setProperty("spring.cloud.contract.stubrunner.properties.bar.bar", "foo") + System.setProperty("spring.cloud.contract.stubrunner.delete-stubs-after-test", "false") + System.setProperty("spring.cloud.contract.stubrunner.generate-stubs", "true") + System.setProperty("spring.cloud.contract.stubrunner.fail-on-no-stubs", "false") + System.setProperty("spring.cloud.contract.stubrunner.http-server-stub-configurer", "org.springframework.cloud.contract.stubrunner.Foo") when: StubRunnerOptions options = StubRunnerOptions.fromSystemProps() then: diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerPropertyUtilsSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerPropertyUtilsSpec.groovy index 1a96ab3e73..ba56bbf226 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerPropertyUtilsSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerPropertyUtilsSpec.groovy @@ -35,7 +35,7 @@ class StubRunnerPropertyUtilsSpec extends Specification { @Override String envVar(String prop) { - assert prop == expectedEnv || prop == "STUBRUNNER_PROPERTIES_" + expectedEnv + assert prop == expectedEnv || prop == "SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_" + expectedEnv return envVar } } @@ -61,13 +61,13 @@ class StubRunnerPropertyUtilsSpec extends Specification { PropertyFetcher fetcher = new PropertyFetcher() { @Override String systemProp(String prop) { - assert prop == checkedSysProp || prop == checkedSysProp - "stubrunner.properties." + assert prop == checkedSysProp || prop == checkedSysProp - "spring.cloud.contract.stubrunner.properties." return sysProp } @Override String envVar(String prop) { - assert prop == checkedEnvVar || prop == checkedEnvVar - "STUBRUNNER_PROPERTIES_" + assert prop == checkedEnvVar || prop == checkedEnvVar - "SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_" return envVar } } @@ -76,10 +76,10 @@ class StubRunnerPropertyUtilsSpec extends Specification { expectedResult == StubRunnerPropertyUtils.getProperty(map, queriedProp) where: queriedProp | map | systemProperty | envVariable | expectedResult | assertedSystemProp | assertedEnvVar - "foo.bar-baz" | ["foo.bar-baz": "faz"] | "ab" | "bc" | "faz" | "stubrunner.properties.foo.bar-baz" | "STUBRUNNER_PROPERTIES_FOO_BAR_BAZ" - "foo.bar-baz" | [:] | "ab" | "bc" | "ab" | "stubrunner.properties.foo.bar-baz" | "STUBRUNNER_PROPERTIES_FOO_BAR_BAZ" - "foo.bar-baz" | [:] | "" | "bc" | "bc" | "stubrunner.properties.foo.bar-baz" | "STUBRUNNER_PROPERTIES_FOO_BAR_BAZ" - "foo.bar-baz" | null | "" | "bc" | "bc" | "stubrunner.properties.foo.bar-baz" | "STUBRUNNER_PROPERTIES_FOO_BAR_BAZ" + "foo.bar-baz" | ["foo.bar-baz": "faz"] | "ab" | "bc" | "faz" | "spring.cloud.contract.stubrunner.properties.foo.bar-baz" | "SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_FOO_BAR_BAZ" + "foo.bar-baz" | [:] | "ab" | "bc" | "ab" | "spring.cloud.contract.stubrunner.properties.foo.bar-baz" | "SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_FOO_BAR_BAZ" + "foo.bar-baz" | [:] | "" | "bc" | "bc" | "spring.cloud.contract.stubrunner.properties.foo.bar-baz" | "SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_FOO_BAR_BAZ" + "foo.bar-baz" | null | "" | "bc" | "bc" | "spring.cloud.contract.stubrunner.properties.foo.bar-baz" | "SPRING_CLOUD_CONTRACT_STUBRUNNER_PROPERTIES_FOO_BAR_BAZ" } @RestoreSystemProperties diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleCustomMsgVerifierSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleCustomMsgVerifierSpec.groovy index fa9bbff8ea..8ac19d390e 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleCustomMsgVerifierSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleCustomMsgVerifierSpec.groovy @@ -37,8 +37,8 @@ class StubRunnerRuleCustomMsgVerifierSpec extends Specification { @BeforeClass @AfterClass void setupProps() { - System.clearProperty("stubrunner.repository.root") - System.clearProperty("stubrunner.classifier") + System.clearProperty("spring.cloud.contract.stubrunner.repository.root") + System.clearProperty("spring.cloud.contract.stubrunner.classifier") } @ClassRule diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleCustomPortJUnitTest.java b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleCustomPortJUnitTest.java index 7aa72de919..6228dfa2e2 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleCustomPortJUnitTest.java +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleCustomPortJUnitTest.java @@ -47,8 +47,8 @@ public class StubRunnerRuleCustomPortJUnitTest { @BeforeClass @AfterClass public static void setupProps() { - System.clearProperty("stubrunner.repository.root"); - System.clearProperty("stubrunner.classifier"); + System.clearProperty("spring.cloud.contract.stubrunner.repository.root"); + System.clearProperty("spring.cloud.contract.stubrunner.classifier"); } // end::classrule_with_port[] diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleExceptionThrowingSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleExceptionThrowingSpec.groovy index 9869048117..0374e32aba 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleExceptionThrowingSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleExceptionThrowingSpec.groovy @@ -33,8 +33,8 @@ class StubRunnerRuleExceptionThrowingSpec extends Specification { @BeforeClass @AfterClass void setupProps() { - System.clearProperty("stubrunner.repository.root") - System.clearProperty("stubrunner.classifier") + System.clearProperty("spring.cloud.contract.stubrunner.repository.root") + System.clearProperty("spring.cloud.contract.stubrunner.classifier") } @ClassRule diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleJUnitTest.java b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleJUnitTest.java index 4d5a2e2ae6..a512eda335 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleJUnitTest.java +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleJUnitTest.java @@ -46,8 +46,8 @@ public class StubRunnerRuleJUnitTest { @BeforeClass @AfterClass public static void setupProps() { - System.clearProperty("stubrunner.repository.root"); - System.clearProperty("stubrunner.classifier"); + System.clearProperty("spring.cloud.contract.stubrunner.repository.root"); + System.clearProperty("spring.cloud.contract.stubrunner.classifier"); } // end::classrule[] diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleSpec.groovy index 2189b8f613..99a20e34a9 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/junit4/StubRunnerRuleSpec.groovy @@ -33,8 +33,8 @@ class StubRunnerRuleSpec extends Specification { @BeforeClass @AfterClass void setupProps() { - System.clearProperty("stubrunner.repository.root") - System.clearProperty("stubrunner.classifier") + System.clearProperty("spring.cloud.contract.stubrunner.repository.root") + System.clearProperty("spring.cloud.contract.stubrunner.classifier") } // tag::classrule[] diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfigurationSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfigurationSpec.groovy index b349bdf92d..551fec2139 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfigurationSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfigurationSpec.groovy @@ -46,8 +46,8 @@ import org.springframework.test.context.ActiveProfiles // Not necessary if Spring Cloud is used. TODO: make it work without this. // tag::test[] @SpringBootTest(classes = Config, properties = [" stubrunner.cloud.enabled=false", - 'foo=${stubrunner.runningstubs.fraudDetectionServer.port}', - 'fooWithGroup=${stubrunner.runningstubs.org.springframework.cloud.contract.verifier.stubs.fraudDetectionServer.port}']) + 'foo=${spring.cloud.contract.stubrunner.runningstubs.fraudDetectionServer.port}', + 'fooWithGroup=${spring.cloud.contract.stubrunner.runningstubs.org.springframework.cloud.contract.verifier.stubs.fraudDetectionServer.port}']) // tag::annotation[] @AutoConfigureStubRunner(mappingsOutputFolder = "target/outputmappings/", httpServerStubConfigurer = HttpsForFraudDetection) @@ -68,8 +68,8 @@ class StubRunnerConfigurationSpec { @BeforeAll static void setupSpec() { - System.clearProperty("stubrunner.repository.root") - System.clearProperty("stubrunner.classifier") + System.clearProperty("spring.cloud.contract.stubrunner.repository.root") + System.clearProperty("spring.cloud.contract.stubrunner.classifier") WireMockHttpServerStubAccessor.clear() } @@ -116,14 +116,14 @@ class StubRunnerConfigurationSpec { @Test void 'should register started servers as environment variables'() { expect: - assert environment.getProperty("stubrunner.runningstubs.loanIssuance.port") != null - assert stubFinder.findAllRunningStubs().getPort("loanIssuance") == (environment.getProperty("stubrunner.runningstubs.loanIssuance.port") as Integer) + assert environment.getProperty("spring.cloud.contract.stubrunner.runningstubs.loanIssuance.port") != null + assert stubFinder.findAllRunningStubs().getPort("loanIssuance") == (environment.getProperty("spring.cloud.contract.stubrunner.runningstubs.loanIssuance.port") as Integer) and: - assert environment.getProperty("stubrunner.runningstubs.fraudDetectionServer.port") != null - assert stubFinder.findAllRunningStubs().getPort("fraudDetectionServer") == (environment.getProperty("stubrunner.runningstubs.fraudDetectionServer.port") as Integer) + assert environment.getProperty("spring.cloud.contract.stubrunner.runningstubs.fraudDetectionServer.port") != null + assert stubFinder.findAllRunningStubs().getPort("fraudDetectionServer") == (environment.getProperty("spring.cloud.contract.stubrunner.runningstubs.fraudDetectionServer.port") as Integer) and: - assert environment.getProperty("stubrunner.runningstubs.fraudDetectionServer.port") != null - assert stubFinder.findAllRunningStubs().getPort("fraudDetectionServer") == (environment.getProperty("stubrunner.runningstubs.org.springframework.cloud.contract.verifier.stubs.fraudDetectionServer.port") as Integer) + assert environment.getProperty("spring.cloud.contract.stubrunner.runningstubs.fraudDetectionServer.port") != null + assert stubFinder.findAllRunningStubs().getPort("fraudDetectionServer") == (environment.getProperty("spring.cloud.contract.stubrunner.runningstubs.org.springframework.cloud.contract.verifier.stubs.fraudDetectionServer.port") as Integer) } @Test diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy index ec55098b32..fc06cfb4a2 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy @@ -63,8 +63,8 @@ class StubRunnerSpringCloudAutoConfigurationSpec { @BeforeAll static void setupSpec() { - System.clearProperty("stubrunner.repository.root") - System.clearProperty("stubrunner.classifier") + System.clearProperty("spring.cloud.contract.stubrunner.repository.root") + System.clearProperty("spring.cloud.contract.stubrunner.classifier") } @AfterAll diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudReactiveAutoConfigurationSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudReactiveAutoConfigurationSpec.groovy index 5ae03ada2e..98549b599a 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudReactiveAutoConfigurationSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudReactiveAutoConfigurationSpec.groovy @@ -63,8 +63,8 @@ class StubRunnerSpringCloudReactiveAutoConfigurationSpec { @BeforeClass @AfterClass static void setupProps() { - System.clearProperty("stubrunner.repository.root") - System.clearProperty("stubrunner.classifier") + System.clearProperty("spring.cloud.contract.stubrunner.repository.root") + System.clearProperty("spring.cloud.contract.stubrunner.classifier") } @BeforeEach diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerNotMatchingConsumerSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerNotMatchingConsumerSpec.groovy index 16e33d2ace..aef1f3bc53 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerNotMatchingConsumerSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerNotMatchingConsumerSpec.groovy @@ -46,7 +46,7 @@ class StubRunnerStubsPerConsumerNotMatchingConsumerSpec { private ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(Config)) .withPropertyValues("spring.application.name=bar-not-matching-consumer", - "stubrunner.jms.enabled=false", "spring.profiles.active=streamconsumer", "spring.cloud.discovery.enabled=false", "spring.cloud.service-registry.auto-registration.enabled=false", "stubrunner.ids=org.springframework.cloud.contract.verifier.stubs:producerWithMultipleConsumers", "stubrunner.repositoryRoot=classpath:m2repo/repository/", "stubrunner.stubsMode=REMOTE", "stubrunner.stubsPerConsumer=true"); + "spring.cloud.contract.stubrunner.jms.enabled=false", "spring.profiles.active=streamconsumer", "spring.cloud.discovery.enabled=false", "spring.cloud.service-registry.auto-registration.enabled=false", "spring.cloud.contract.stubrunner.ids=org.springframework.cloud.contract.verifier.stubs:producerWithMultipleConsumers", "spring.cloud.contract.stubrunner.repositoryRoot=classpath:m2repo/repository/", "spring.cloud.contract.stubrunner.stubsMode=REMOTE", "spring.cloud.contract.stubrunner.stubsPerConsumer=true"); @Test void 'should fail to start when JAR is found but there are no stubs or contracts'() { diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerSpec.groovy index 0810ba0af2..271449a420 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerSpec.groovy @@ -43,7 +43,7 @@ import org.springframework.test.context.ActiveProfiles */ // tag::test[] @SpringBootTest(classes = Config, properties = ["spring.application.name=bar-consumer", - "stubrunner.jms.enabled=false"]) + "spring.cloud.contract.stubrunner.jms.enabled=false"]) @AutoConfigureStubRunner(ids = "org.springframework.cloud.contract.verifier.stubs:producerWithMultipleConsumers", repositoryRoot = "classpath:m2repo/repository/", stubsMode = StubRunnerProperties.StubsMode.REMOTE, diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerWithConsumerNameSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerWithConsumerNameSpec.groovy index e3e9ad8559..47b7c8b531 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerWithConsumerNameSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerWithConsumerNameSpec.groovy @@ -42,7 +42,7 @@ import org.springframework.test.context.ActiveProfiles * @author Marcin Grzejszczak */ // tag::test[] -@SpringBootTest(classes = Config, properties = "stubrunner.jms.enabled=false") +@SpringBootTest(classes = Config, properties = "spring.cloud.contract.stubrunner.jms.enabled=false") @AutoConfigureStubRunner(ids = "org.springframework.cloud.contract.verifier.stubs:producerWithMultipleConsumers", repositoryRoot = "classpath:m2repo/repository/", consumerName = "foo-consumer", diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfigurationSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfigurationSpec.groovy index 267c1221c1..26f943ae75 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfigurationSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfigurationSpec.groovy @@ -43,11 +43,11 @@ import static org.mockito.Mockito.mock @SpringBootTest(classes = Config, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = ["eureka.client.enabled=false", "spring.cloud.zookeeper.enabled=false", - "stubrunner.cloud.stubbed.discovery.enabled=false", - "stubrunner.cloud.eureka.enabled=false", + "spring.cloud.contract.stubrunner.cloud.stubbed.discovery.enabled=false", + "spring.cloud.contract.stubrunner.cloud.eureka.enabled=false", "spring.cloud.zookeeper.discovery.enabled=false", - "stubrunner.cloud.consul.enabled=true", - "stubrunner.cloud.zookeeper.enabled=false", + "spring.cloud.contract.stubrunner.cloud.consul.enabled=true", + "spring.cloud.contract.stubrunner.cloud.zookeeper.enabled=false", "debug=true"]) // tag::autoconfigure[] @AutoConfigureStubRunner(ids = ["org.springframework.cloud.contract.verifier.stubs:loanIssuance", @@ -63,8 +63,8 @@ class StubRunnerSpringCloudConsulAutoConfigurationSpec { @BeforeAll static void setupSpec() { - System.clearProperty("stubrunner.stubs.repository.root") - System.clearProperty("stubrunner.stubs.classifier") + System.clearProperty("spring.cloud.contract.stubrunner.stubs.repository.root") + System.clearProperty("spring.cloud.contract.stubrunner.stubs.classifier") } @AfterAll diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/StubRunnerSliceTests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/StubRunnerSliceTests.java index 5ccb13a9e9..14b3c0d8c5 100644 --- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/StubRunnerSliceTests.java +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/StubRunnerSliceTests.java @@ -52,10 +52,10 @@ public class StubRunnerSliceTests { @Autowired private StubRunnerProperties properties; - @Value("${stubrunner.runningstubs.fraudDetectionServer.port}") + @Value("${spring.cloud.contract.stubrunner.runningstubs.fraudDetectionServer.port}") private Integer fraudDetectionServerPort; - @Value("${stubrunner.runningstubs.loanIssuance.port}") + @Value("${spring.cloud.contract.stubrunner.runningstubs.loanIssuance.port}") private Integer loanIssuancePort; @Test diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/issue1225/Issue1225Tests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/issue1225/Issue1225Tests.java index 6b5a086b23..69be091ac4 100644 --- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/issue1225/Issue1225Tests.java +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/issue1225/Issue1225Tests.java @@ -39,7 +39,8 @@ * @author Biju Kunjummen */ @RunWith(SpringRunner.class) -@SpringBootTest(properties = { "ping.url=http://localhost:${stubrunner.runningstubs.loanIssuance.port}" }) +@SpringBootTest( + properties = { "ping.url=http://localhost:${spring.cloud.contract.stubrunner.runningstubs.loanIssuance.port}" }) @AutoConfigureStubRunner(ids = { "org.springframework.cloud.contract.verifier.stubs:loanIssuance:+:stubs", "org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer:+:stubs" }) @ActiveProfiles("test") diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionCustomMessageVerifierTests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionCustomMessageVerifierTests.java index 8535ed188e..9beee8e746 100644 --- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionCustomMessageVerifierTests.java +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionCustomMessageVerifierTests.java @@ -51,8 +51,8 @@ class StubRunnerJUnit5ExtensionCustomMessageVerifierTests { @BeforeAll @AfterAll static void setupProps() { - System.clearProperty("stubrunner.repository.root"); - System.clearProperty("stubrunner.classifier"); + System.clearProperty("spring.cloud.contract.stubrunner.repository.root"); + System.clearProperty("spring.cloud.contract.stubrunner.classifier"); } private static String repoRoot() { diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionCustomPortTests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionCustomPortTests.java index 9a697b534b..d6be3c46d1 100644 --- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionCustomPortTests.java +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionCustomPortTests.java @@ -46,8 +46,8 @@ class StubRunnerJUnit5ExtensionCustomPortTests { @BeforeAll @AfterAll static void setupProps() { - System.clearProperty("stubrunner.repository.root"); - System.clearProperty("stubrunner.classifier"); + System.clearProperty("spring.cloud.contract.stubrunner.repository.root"); + System.clearProperty("spring.cloud.contract.stubrunner.classifier"); } private static String repoRoot() { diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionExceptionThrowingTests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionExceptionThrowingTests.java index d4689283c5..766e57ce86 100644 --- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionExceptionThrowingTests.java +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionExceptionThrowingTests.java @@ -41,8 +41,8 @@ public class StubRunnerJUnit5ExtensionExceptionThrowingTests { @BeforeAll @AfterAll static void setupProps() { - System.clearProperty("stubrunner.repository.root"); - System.clearProperty("stubrunner.classifier"); + System.clearProperty("spring.cloud.contract.stubrunner.repository.root"); + System.clearProperty("spring.cloud.contract.stubrunner.classifier"); } private static String repoRoot() { diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionTests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionTests.java index ffeff4b68f..10bc1d8cc7 100644 --- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionTests.java +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5ExtensionTests.java @@ -47,8 +47,8 @@ class StubRunnerJUnit5ExtensionTests { @BeforeAll @AfterAll static void setupProps() { - System.clearProperty("stubrunner.repository.root"); - System.clearProperty("stubrunner.classifier"); + System.clearProperty("spring.cloud.contract.stubrunner.repository.root"); + System.clearProperty("spring.cloud.contract.stubrunner.classifier"); } private static String repoRoot() { diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5MethodExtensionTests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5MethodExtensionTests.java index 963778151e..195b19cb6d 100644 --- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5MethodExtensionTests.java +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/junit/StubRunnerJUnit5MethodExtensionTests.java @@ -47,8 +47,8 @@ class StubRunnerJUnit5MethodExtensionTests { @BeforeEach @AfterEach void setupProps() { - System.clearProperty("stubrunner.repository.root"); - System.clearProperty("stubrunner.classifier"); + System.clearProperty("spring.cloud.contract.stubrunner.repository.root"); + System.clearProperty("spring.cloud.contract.stubrunner.classifier"); } private static String repoRoot() { diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/server/StubRunnerServerConfigurationTests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/server/StubRunnerServerConfigurationTests.java index b3c47df266..37684aee6b 100644 --- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/server/StubRunnerServerConfigurationTests.java +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/server/StubRunnerServerConfigurationTests.java @@ -43,18 +43,20 @@ public void shouldCreateBeansByDefault() { @Test public void shouldNotCreateBeansWhenDisabled() { - this.contextRunner.withPropertyValues("stubrunner.messaging.enabled=false").run((context) -> { - assertThat(context.getBeansOfType(ContractVerifierMessaging.class)).hasSize(0); - assertThat(context.getBeansOfType(TriggerController.class)).hasSize(0); - }); + this.contextRunner.withPropertyValues("spring.cloud.contract.stubrunner.messaging.enabled=false") + .run((context) -> { + assertThat(context.getBeansOfType(ContractVerifierMessaging.class)).hasSize(0); + assertThat(context.getBeansOfType(TriggerController.class)).hasSize(0); + }); } @Test public void shouldCreateBeansWhenExplicitlyEnabled() { - this.contextRunner.withPropertyValues("stubrunner.messaging.enabled=true").run((context) -> { - assertThat(context.getBeansOfType(ContractVerifierMessaging.class)).hasSize(1); - assertThat(context.getBeansOfType(TriggerController.class)).hasSize(1); - }); + this.contextRunner.withPropertyValues("spring.cloud.contract.stubrunner.messaging.enabled=true") + .run((context) -> { + assertThat(context.getBeansOfType(ContractVerifierMessaging.class)).hasSize(1); + assertThat(context.getBeansOfType(TriggerController.class)).hasSize(1); + }); } } diff --git a/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml b/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml index e58fa3a04f..a5f269223b 100644 --- a/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml +++ b/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml @@ -1,4 +1,4 @@ -stubrunner: +spring.cloud.contract.stubrunner: cloud.stubbed.discovery.enabled: true spring.cloud: zookeeper: diff --git a/spring-cloud-contract-stub-runner/src/test/resources/application-test-with-placeholders.yml b/spring-cloud-contract-stub-runner/src/test/resources/application-test-with-placeholders.yml index f146989f96..92fad751a6 100644 --- a/spring-cloud-contract-stub-runner/src/test/resources/application-test-with-placeholders.yml +++ b/spring-cloud-contract-stub-runner/src/test/resources/application-test-with-placeholders.yml @@ -1,6 +1,6 @@ provider.stub.artifact.id: fraudDetectionServer -stubrunner: +spring.cloud.contract.stubrunner: repositoryRoot: classpath:m2repo/repository/ ids: - ${some.property1} @@ -20,4 +20,4 @@ spring: main: allow-bean-definition-overriding: true -stub.port: ${stubrunner.runningstubs.${provider.stub.artifact.id}.port} \ No newline at end of file +stub.port: ${spring.cloud.contract.stubrunner.runningstubs.${provider.stub.artifact.id}.port} \ No newline at end of file diff --git a/spring-cloud-contract-stub-runner/src/test/resources/application-test.yml b/spring-cloud-contract-stub-runner/src/test/resources/application-test.yml index b442108385..eeb6edfc21 100644 --- a/spring-cloud-contract-stub-runner/src/test/resources/application-test.yml +++ b/spring-cloud-contract-stub-runner/src/test/resources/application-test.yml @@ -1,5 +1,5 @@ # tag::test[] -stubrunner: +spring.cloud.contract.stubrunner: repositoryRoot: classpath:m2repo/repository/ ids: - org.springframework.cloud.contract.verifier.stubs:loanIssuance diff --git a/spring-cloud-contract-stub-runner/src/test/resources/application.yml b/spring-cloud-contract-stub-runner/src/test/resources/application.yml index e9169ba808..8012a82235 100644 --- a/spring-cloud-contract-stub-runner/src/test/resources/application.yml +++ b/spring-cloud-contract-stub-runner/src/test/resources/application.yml @@ -4,7 +4,7 @@ spring.cloud: eureka.client.enabled: false stubrunner.camel.enabled: false # tag::ids[] -stubrunner: +spring.cloud.contract.stubrunner: idsToServiceIds: ivyNotation: someValueInsideYourCode fraudDetectionServer: someNameThatShouldMapFraudDetectionServer diff --git a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfiguration.java b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfiguration.java index 6a29e95f3a..07b63fca72 100644 --- a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfiguration.java +++ b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfiguration.java @@ -47,7 +47,8 @@ @Configuration(proxyBeanMethods = false) @ConditionalOnClass(Message.class) @Import(CamelAutoConfiguration.class) -@ConditionalOnProperty(name = "stubrunner.camel.enabled", havingValue = "true", matchIfMissing = true) +@ConditionalOnProperty(name = "spring.cloud.contract.stubrunner.camel.enabled", havingValue = "true", + matchIfMissing = true) @AutoConfigureBefore({ NoOpContractVerifierAutoConfiguration.class, ContractVerifierJmsConfiguration.class }) public class ContractVerifierCamelConfiguration { diff --git a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/jms/ContractVerifierJmsConfiguration.java b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/jms/ContractVerifierJmsConfiguration.java index 12b4c252ea..430d12183a 100644 --- a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/jms/ContractVerifierJmsConfiguration.java +++ b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/jms/ContractVerifierJmsConfiguration.java @@ -51,7 +51,8 @@ */ @Configuration(proxyBeanMethods = false) @ConditionalOnClass(JmsTemplate.class) -@ConditionalOnProperty(name = "stubrunner.jms.enabled", havingValue = "true", matchIfMissing = true) +@ConditionalOnProperty(name = "spring.cloud.contract.stubrunner.jms.enabled", havingValue = "true", + matchIfMissing = true) @AutoConfigureBefore({ ContractVerifierIntegrationConfiguration.class, NoOpContractVerifierAutoConfiguration.class }) public class ContractVerifierJmsConfiguration { diff --git a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfiguration.java b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfiguration.java index 40219cd565..b078dc3e3a 100644 --- a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfiguration.java +++ b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfiguration.java @@ -44,7 +44,8 @@ */ @Configuration(proxyBeanMethods = false) @ConditionalOnClass(Binder.class) -@ConditionalOnProperty(name = "stubrunner.stream.enabled", havingValue = "true", matchIfMissing = true) +@ConditionalOnProperty(name = "spring.cloud.contract.stubrunner.stream.enabled", havingValue = "true", + matchIfMissing = true) @AutoConfigureBefore(NoOpContractVerifierAutoConfiguration.class) public class ContractVerifierStreamAutoConfiguration { diff --git a/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfigurationTests.java b/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfigurationTests.java index 592888fd6b..afd884d0dd 100644 --- a/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfigurationTests.java +++ b/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfigurationTests.java @@ -41,7 +41,7 @@ public void shouldCreateBeansByDefault() { @Test public void shouldNotCreateBeansWhenDisabled() { - this.contextRunner.withPropertyValues("stubrunner.camel.enabled=false").run((context) -> { + this.contextRunner.withPropertyValues("spring.cloud.contract.stubrunner.camel.enabled=false").run((context) -> { assertThat(context.getBeansOfType(CamelStubMessages.class)).hasSize(0); assertThat(context.getBeansOfType(ContractVerifierCamelHelper.class)).hasSize(0); }); @@ -49,7 +49,7 @@ public void shouldNotCreateBeansWhenDisabled() { @Test public void shouldCreateBeansWhenExplicitlyEnabled() { - this.contextRunner.withPropertyValues("stubrunner.camel.enabled=true").run((context) -> { + this.contextRunner.withPropertyValues("spring.cloud.contract.stubrunner.camel.enabled=true").run((context) -> { assertThat(context.getBeansOfType(CamelStubMessages.class)).hasSize(1); assertThat(context.getBeansOfType(ContractVerifierCamelHelper.class)).hasSize(1); }); diff --git a/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/jms/ContractVerifierJmsConfigurationTests.java b/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/jms/ContractVerifierJmsConfigurationTests.java index 7294dd3f15..6de9e4d851 100644 --- a/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/jms/ContractVerifierJmsConfigurationTests.java +++ b/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/jms/ContractVerifierJmsConfigurationTests.java @@ -41,7 +41,7 @@ public void shouldCreateBeansByDefault() { @Test public void shouldNotCreateBeansWhenDisabled() { - this.contextRunner.withPropertyValues("stubrunner.jms.enabled=false").run((context) -> { + this.contextRunner.withPropertyValues("spring.cloud.contract.stubrunner.jms.enabled=false").run((context) -> { assertThat(context.getBeansOfType(JmsStubMessages.class)).hasSize(0); assertThat(context.getBeansOfType(ContractVerifierJmsHelper.class)).hasSize(0); }); @@ -49,7 +49,7 @@ public void shouldNotCreateBeansWhenDisabled() { @Test public void shouldCreateBeansWhenExplicitlyEnabled() { - this.contextRunner.withPropertyValues("stubrunner.jms.enabled=true").run((context) -> { + this.contextRunner.withPropertyValues("spring.cloud.contract.stubrunner.jms.enabled=true").run((context) -> { assertThat(context.getBeansOfType(JmsStubMessages.class)).hasSize(1); assertThat(context.getBeansOfType(ContractVerifierJmsHelper.class)).hasSize(1); }); diff --git a/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfigurationTests.java b/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfigurationTests.java index bd31dcf373..d97615de35 100644 --- a/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfigurationTests.java +++ b/spring-cloud-contract-verifier/src/test/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfigurationTests.java @@ -41,15 +41,16 @@ public void shouldCreateBeansByDefault() { @Test public void shouldNotCreateBeansWhenDisabled() { - this.contextRunner.withPropertyValues("stubrunner.stream.enabled=false").run((context) -> { - assertThat(context.getBeansOfType(ContractVerifierHelper.class)).hasSize(0); - assertThat(context.getBeansOfType(StreamStubMessages.class)).hasSize(0); - }); + this.contextRunner.withPropertyValues("spring.cloud.contract.stubrunner.stream.enabled=false") + .run((context) -> { + assertThat(context.getBeansOfType(ContractVerifierHelper.class)).hasSize(0); + assertThat(context.getBeansOfType(StreamStubMessages.class)).hasSize(0); + }); } @Test public void shouldCreateBeansWhenExplicitlyEnabled() { - this.contextRunner.withPropertyValues("stubrunner.stream.enabled=true").run((context) -> { + this.contextRunner.withPropertyValues("spring.cloud.contract.stubrunner.stream.enabled=true").run((context) -> { assertThat(context.getBeansOfType(ContractVerifierHelper.class)).hasSize(1); assertThat(context.getBeansOfType(StreamStubMessages.class)).hasSize(1); }); diff --git a/tests/samples-messaging-amqp/src/test/groovy/com/example/AmqpMessagingApplicationSpec.groovy b/tests/samples-messaging-amqp/src/test/groovy/com/example/AmqpMessagingApplicationSpec.groovy index ea277bf924..888115ecd7 100644 --- a/tests/samples-messaging-amqp/src/test/groovy/com/example/AmqpMessagingApplicationSpec.groovy +++ b/tests/samples-messaging-amqp/src/test/groovy/com/example/AmqpMessagingApplicationSpec.groovy @@ -32,7 +32,7 @@ import org.springframework.cloud.contract.verifier.messaging.internal.ContractVe // Context configuration would end up in base class @AutoConfigureMessageVerifier -@SpringBootTest(classes = AmqpMessagingApplication, properties = "stubrunner.amqp.enabled=true") +@SpringBootTest(classes = AmqpMessagingApplication, properties = "spring.cloud.contract.stubrunner.amqp.enabled=true") @Disabled("TODO: Migrate to middleware based approach") class AmqpMessagingApplicationSpec { diff --git a/tests/samples-messaging-amqp/src/test/resources/application.yml b/tests/samples-messaging-amqp/src/test/resources/application.yml index 13f5f325d6..21d0aee15b 100644 --- a/tests/samples-messaging-amqp/src/test/resources/application.yml +++ b/tests/samples-messaging-amqp/src/test/resources/application.yml @@ -1 +1 @@ -stubrunner.amqp.enabled: true +spring.cloud.contract.stubrunner.amqp.enabled: true diff --git a/tests/spring-cloud-contract-stub-runner-amqp/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-amqp/src/test/resources/application.yml index e80226b65d..962126e4ff 100644 --- a/tests/spring-cloud-contract-stub-runner-amqp/src/test/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-amqp/src/test/resources/application.yml @@ -1,4 +1,4 @@ -stubrunner: +spring.cloud.contract.stubrunner: repositoryRoot: classpath:m2repo/repository/ ids: org.springframework.cloud.contract.verifier.stubs.amqp:spring-cloud-contract-amqp-test:0.4.0-SNAPSHOT:stubs stubs-mode: remote diff --git a/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/eureka/StubRunnerSpringCloudEurekaAutoConfigurationSpec.groovy b/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/eureka/StubRunnerSpringCloudEurekaAutoConfigurationSpec.groovy index c496c3e2bd..8aa98d5bf7 100644 --- a/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/eureka/StubRunnerSpringCloudEurekaAutoConfigurationSpec.groovy +++ b/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/eureka/StubRunnerSpringCloudEurekaAutoConfigurationSpec.groovy @@ -55,8 +55,8 @@ import org.springframework.web.client.RestTemplate */ //TODO: Speed up this test somehow (move it out of Spring Cloud Contract core to samples) @SpringBootTest(classes = Config, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = ["stubrunner.cloud.eureka.enabled=true", - "stubrunner.cloud.stubbed.discovery.enabled=false", + properties = ["spring.cloud.contract.stubrunner.cloud.eureka.enabled=true", + "spring.cloud.contract.stubrunner.cloud.stubbed.discovery.enabled=false", "eureka.client.enabled=true", "eureka.client.restclient.enabled=false", "eureka.client.webclient.enabled=false", @@ -81,11 +81,11 @@ class StubRunnerSpringCloudEurekaAutoConfigurationSpec { @BeforeAll static void setupSpec() { - System.clearProperty("stubrunner.stubs.repository.root") - System.clearProperty("stubrunner.stubs.classifier") + System.clearProperty("spring.cloud.contract.stubrunner.stubs.repository.root") + System.clearProperty("spring.cloud.contract.stubrunner.stubs.classifier") eurekaServer = SpringApplication.run(EurekaServer, - "--stubrunner.cloud.eureka.enabled=true", - "--stubrunner.cloud.stubbed.discovery.enabled=false", + "--spring.cloud.contract.stubrunner.cloud.eureka.enabled=true", + "--spring.cloud.contract.stubrunner.cloud.stubbed.discovery.enabled=false", "--eureka.client.enabled=true", "--server.port=8761", "--spring.profiles.active=eureka") @@ -93,8 +93,8 @@ class StubRunnerSpringCloudEurekaAutoConfigurationSpec { @AfterAll static void cleanupSpec() { - System.clearProperty("stubrunner.stubs.repository.root") - System.clearProperty("stubrunner.stubs.classifier") + System.clearProperty("spring.cloud.contract.stubrunner.stubs.repository.root") + System.clearProperty("spring.cloud.contract.stubrunner.stubs.classifier") } @Test diff --git a/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/resources/application.yml index 2b91381a2c..b9dee83076 100644 --- a/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/resources/application.yml @@ -1,4 +1,4 @@ -stubrunner: +spring.cloud.contract.stubrunner: idsToServiceIds: fraudDetectionServer: someNameThatShouldMapFraudDetectionServer server: diff --git a/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfigurationSpec.groovy b/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfigurationSpec.groovy index 3f1c3a19a0..5b5312c42c 100644 --- a/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfigurationSpec.groovy +++ b/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfigurationSpec.groovy @@ -40,7 +40,7 @@ import org.springframework.web.client.RestTemplate * @author Marcin Grzejszczak */ @SpringBootTest(classes = Config, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = ["stubrunner.cloud.stubbed.discovery.enabled=false", + properties = ["spring.cloud.contract.stubrunner.cloud.stubbed.discovery.enabled=false", "debug=true"]) @AutoConfigureStubRunner(ids = ["org.springframework.cloud.contract.verifier.stubs:loanIssuance", "org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer", @@ -57,8 +57,8 @@ class StubRunnerSpringCloudZookeeperAutoConfigurationSpec { @BeforeAll static void setupSpec() { - System.clearProperty("stubrunner.stubs.repository.root") - System.clearProperty("stubrunner.stubs.classifier") + System.clearProperty("spring.cloud.contract.stubrunner.stubs.repository.root") + System.clearProperty("spring.cloud.contract.stubrunner.stubs.classifier") } @AfterAll diff --git a/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/resources/application.yml index 2b91381a2c..b9dee83076 100644 --- a/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/resources/application.yml @@ -1,4 +1,4 @@ -stubrunner: +spring.cloud.contract.stubrunner: idsToServiceIds: fraudDetectionServer: someNameThatShouldMapFraudDetectionServer server: diff --git a/tests/spring-cloud-contract-stub-runner-context-path/src/test/java/com/example/loan/FailFastLoanApplicationServiceTests.java b/tests/spring-cloud-contract-stub-runner-context-path/src/test/java/com/example/loan/FailFastLoanApplicationServiceTests.java index 0b41d741bb..89ae14edca 100644 --- a/tests/spring-cloud-contract-stub-runner-context-path/src/test/java/com/example/loan/FailFastLoanApplicationServiceTests.java +++ b/tests/spring-cloud-contract-stub-runner-context-path/src/test/java/com/example/loan/FailFastLoanApplicationServiceTests.java @@ -38,8 +38,9 @@ public void shouldFailToStartContextWhenNoStubCanBeFound() { // When final Throwable throwable = catchThrowable( () -> new SpringApplicationBuilder(Application.class, StubRunnerConfiguration.class) - .properties(Map.of("stubrunner.stubsMode", "REMOTE", "stubrunner.repositoryRoot", - "classpath:m2repo/repository/", "stubrunner.ids", + .properties(Map.of("spring.cloud.contract.stubrunner.stubsMode", "REMOTE", + "spring.cloud.contract.stubrunner.repositoryRoot", "classpath:m2repo/repository/", + "spring.cloud.contract.stubrunner.ids", new String[] { "org.springframework.cloud.contract.verifier.stubs:should-not-be-found" })) .run()); @@ -55,7 +56,8 @@ public void shouldNotTryAndWorkOfflineWhenRemoteModeIsOn() { // When final Throwable throwable = catchThrowable( () -> new SpringApplicationBuilder(Application.class, StubRunnerConfiguration.class) - .properties(Map.of("stubrunner.stubsMode", "CLASSPATH", "stubrunner.ids", + .properties(Map.of("spring.cloud.contract.stubrunner.stubsMode", "CLASSPATH", + "spring.cloud.contract.stubrunner.ids", new String[] { "org.springframework.cloud.contract.verifier.stubs:should-not-be-found" })) .run()); diff --git a/tests/spring-cloud-contract-stub-runner-integration/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-integration/src/test/resources/application.yml index 3b928a4dad..aab68ac86d 100644 --- a/tests/spring-cloud-contract-stub-runner-integration/src/test/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-integration/src/test/resources/application.yml @@ -1,5 +1,5 @@ -stubrunner.repositoryRoot: classpath:m2repo/repository/ -stubrunner.ids: org.springframework.cloud.contract.verifier.stubs:integrationService:0.0.1-SNAPSHOT -stubrunner.stubs-mode: remote +spring.cloud.contract.stubrunner.repositoryRoot: classpath:m2repo/repository/ +spring.cloud.contract.stubrunner.ids: org.springframework.cloud.contract.verifier.stubs:integrationService:0.0.1-SNAPSHOT +spring.cloud.contract.stubrunner.stubs-mode: remote server: port: 0 diff --git a/tests/spring-cloud-contract-stub-runner-jms/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-jms/src/test/resources/application.yml index 2782cdc1a5..732b001214 100644 --- a/tests/spring-cloud-contract-stub-runner-jms/src/test/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-jms/src/test/resources/application.yml @@ -1,4 +1,4 @@ -stubrunner: +spring.cloud.contract.stubrunner: repository-root: stubs:classpath:/stubs/ ids: my:stubs stubs-mode: remote diff --git a/tests/spring-cloud-contract-stub-runner-kafka/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-kafka/src/test/resources/application.yml index 5f8b6211aa..773aaafbe9 100644 --- a/tests/spring-cloud-contract-stub-runner-kafka/src/test/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-kafka/src/test/resources/application.yml @@ -1,4 +1,4 @@ -stubrunner: +spring.cloud.contract.stubrunner: repository-root: stubs:classpath:/stubs/ ids: my:stubs stubs-mode: remote diff --git a/tests/spring-cloud-contract-stub-runner-moco/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-moco/src/test/resources/application.yml index 0d7455ff18..412ecf0557 100644 --- a/tests/spring-cloud-contract-stub-runner-moco/src/test/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-moco/src/test/resources/application.yml @@ -1,4 +1,4 @@ -stubrunner: +spring.cloud.contract.stubrunner: idsToServiceIds: fraudDetectionServerMoco: someNameThatShouldMapFraudDetectionServer server: diff --git a/tests/spring-cloud-contract-stub-runner-stream/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-stream/src/test/resources/application.yml index 85438a4ff7..c9c42f6687 100644 --- a/tests/spring-cloud-contract-stub-runner-stream/src/test/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-stream/src/test/resources/application.yml @@ -1,6 +1,6 @@ -stubrunner.repositoryRoot: classpath:m2repo/repository/ -stubrunner.ids: org.springframework.cloud.contract.verifier.stubs:streamService:0.0.1-SNAPSHOT:stubs -stubrunner.stubs-mode: remote +spring.cloud.contract.stubrunner.repositoryRoot: classpath:m2repo/repository/ +spring.cloud.contract.stubrunner.ids: org.springframework.cloud.contract.verifier.stubs:streamService:0.0.1-SNAPSHOT:stubs +spring.cloud.contract.stubrunner.stubs-mode: remote spring: cloud: stream: