This commit is contained in:
Marcin Grzejszczak
2023-09-11 19:00:22 +02:00
parent 7322a41390
commit 43318b0b05
119 changed files with 1255 additions and 2028 deletions

View File

@@ -0,0 +1,23 @@
:sc-ext: java
:project-full-name: Spring Cloud Contract
// project-specific attributes
:converters_path: example$tools-src/spring-cloud-contract-converters
:verifier_root_path: example$verifier-src
:contract_spec_path: example$specs-src/spring-cloud-contract-spec-java
:contract_spec_tests_path: example$specs-src/spring-cloud-contract-spec
:contract_kotlin_spec_path: example$specs-src/spring-cloud-contract-spec-kotlin
:samples_path: example$samples-src
:stubrunner_core_path: example$stubrunner-src
:standalone_samples_path: example$samples-src/standalone/dsl
:standalone_messaging_samples_path: example$samples-src/standalone/dsl
:standalone_restdocs_path: example$samples-src/standalone/restdocs
:tests_path: example$tests-src
:tools_path: example$tools-src
:plugins_path: {tools_path}
:samples_branch: main
:samples_url: https://raw.githubusercontent.com/spring-cloud-samples/spring-cloud-contract-samples/{samples_branch}
:samples_code: https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/{samples_branch}
:doc_samples: {samples_code}/wiremock-for-contract-docs
:doc_samples_url: {samples_url}/wiremock-for-contract-docs
:wiremock_tests: example$wiremock-src

View File

@@ -0,0 +1,47 @@
|===
|Name | Default | Description
|stubrunner.amqp.enabled | `+++false+++` | Whether to enable support for Stub Runner and AMQP.
|stubrunner.amqp.mockCOnnection | `+++true+++` | Whether to enable support for Stub Runner and AMQP mocked connection factory.
|stubrunner.classifier | `+++stubs+++` | The classifier to use by default in ivy co-ordinates for a stub.
|stubrunner.cloud.consul.enabled | `+++true+++` | Whether to enable stubs registration in Consul.
|stubrunner.cloud.delegate.enabled | `+++true+++` | Whether to enable DiscoveryClient's Stub Runner implementation.
|stubrunner.cloud.enabled | `+++true+++` | Whether to enable Spring Cloud support for Stub Runner.
|stubrunner.cloud.eureka.enabled | `+++true+++` | Whether to enable stubs registration in Eureka.
|stubrunner.cloud.loadbalancer.enabled | `+++true+++` | Whether to enable Stub Runner's Spring Cloud Load Balancer integration.
|stubrunner.cloud.stubbed.discovery.enabled | `+++true+++` | Whether Service Discovery should be stubbed for Stub Runner. If set to false, stubs will get registered in real service discovery.
|stubrunner.cloud.zookeeper.enabled | `+++true+++` | Whether to enable stubs registration in Zookeeper.
|stubrunner.consumer-name | | You can override the default {@code spring.application.name} of this field by setting a value to this parameter.
|stubrunner.delete-stubs-after-test | `+++true+++` | If set to {@code false} will NOT delete stubs from a temporary folder after running tests.
|stubrunner.fail-on-no-stubs | `+++true+++` | When enabled, this flag will tell stub runner to throw an exception when no stubs / contracts were found.
|stubrunner.generate-stubs | `+++false+++` | When enabled, this flag will tell stub runner to not load the generated stubs, but convert the found contracts at runtime to a stub format and run those stubs.
|stubrunner.http-server-stub-configurer | | Configuration for an HTTP server stub.
|stubrunner.ids | `+++[]+++` | The ids of the stubs to run in "ivy" notation ([groupId]:artifactId:[version]:[classifier][:port]). {@code groupId}, {@code classifier}, {@code version} and {@code port} can be optional.
|stubrunner.ids-to-service-ids | | Mapping of Ivy notation based ids to serviceIds inside your application. Example "a:b" -> "myService" "artifactId" -> "myOtherService"
|stubrunner.integration.enabled | `+++true+++` | Whether to enable Stub Runner integration with Spring Integration.
|stubrunner.jms.enabled | `+++true+++` | Whether to enable Stub Runner integration with Spring JMS.
|stubrunner.kafka.enabled | `+++true+++` | Whether to enable Stub Runner integration with Spring Kafka.
|stubrunner.kafka.initializer.enabled | `+++true+++` | 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.
|stubrunner.mappings-output-folder | | Dumps the mappings of each HTTP server to the selected folder.
|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}.
|stubrunner.proxy-host | | Repository proxy host.
|stubrunner.proxy-port | | Repository proxy port.
|stubrunner.server-id | |
|stubrunner.stream.enabled | `+++true+++` | Whether to enable Stub Runner integration with Spring Cloud Stream.
|stubrunner.stubs-mode | | Pick where the stubs should come from.
|stubrunner.stubs-per-consumer | `+++false+++` | Should only stubs for this particular consumer get registered in HTTP server stub.
|stubrunner.username | | Repository username.
|wiremock.placeholders.enabled | `+++true+++` | Flag to indicate that http URLs in generated wiremock stubs should be filtered to add or resolve a placeholder for a dynamic port.
|wiremock.reset-mappings-after-each-test | `+++false+++` |
|wiremock.rest-template-ssl-enabled | `+++false+++` |
|wiremock.server.files | `+++[]+++` |
|wiremock.server.https-port | `+++-1+++` |
|wiremock.server.https-port-dynamic | `+++false+++` |
|wiremock.server.port | `+++8080+++` |
|wiremock.server.port-dynamic | `+++false+++` |
|wiremock.server.stubs | `+++[]+++` |
|===

View File

@@ -0,0 +1,13 @@
.Docker environment variables - read at runtime
|===
|Name | Description | Default
|APPLICATION_BASE_URL|URL at which the application is running.|
|APPLICATION_PASSWORD|Optional password to access the application.|
|APPLICATION_USERNAME|Optional username to access the application.|
|MESSAGING_TRIGGER_CONNECT_TIMEOUT|Timeout to connect to the application to trigger a message.|5000
|MESSAGING_TRIGGER_READ_TIMEOUT|Timeout to read the response from the application to trigger a message.|5000
|MESSAGING_TYPE|Type of messaging. Can be either [rabbit] or [kafka].|
|MESSAGING_TYPE|Defines the messaging type when dealing with message based contracts.|
|SPRING_KAFKA_BOOTSTRAP_SERVERS|For Kafka - brokers addresses.|
|SPRING_RABBITMQ_ADDRESSES|For RabbitMQ - brokers addresses.|
|===

View File

@@ -0,0 +1,442 @@
{
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract",
"properties" : {
"request" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:Request",
"properties" : {
"method" : {
"type" : "string"
},
"url" : {
"type" : "string"
},
"urlPath" : {
"type" : "string"
},
"queryParameters" : {
"type" : "object",
"additionalProperties" : {
"type" : "object",
"id" : "urn:jsonschema:java:lang:Object"
}
},
"headers" : {
"type" : "object",
"additionalProperties" : {
"type" : "object",
"$ref" : "urn:jsonschema:java:lang:Object"
}
},
"cookies" : {
"type" : "object",
"additionalProperties" : {
"type" : "object",
"$ref" : "urn:jsonschema:java:lang:Object"
}
},
"body" : {
"type" : "object",
"$ref" : "urn:jsonschema:java:lang:Object"
},
"bodyFromFile" : {
"type" : "string"
},
"bodyFromFileAsBytes" : {
"type" : "string"
},
"matchers" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:StubMatchers",
"properties" : {
"url" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:KeyValueMatcher",
"properties" : {
"key" : {
"type" : "string"
},
"regex" : {
"type" : "string"
},
"predefined" : {
"type" : "string",
"enum" : [ "only_alpha_unicode", "number", "any_double", "any_boolean", "ip_address", "hostname", "email", "url", "uuid", "iso_date", "iso_date_time", "iso_time", "iso_8601_with_offset", "non_empty", "non_blank" ]
},
"command" : {
"type" : "string"
},
"regexType" : {
"type" : "string",
"enum" : [ "as_integer", "as_double", "as_float", "as_long", "as_short", "as_boolean", "as_string" ]
}
}
},
"body" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:BodyStubMatcher",
"properties" : {
"path" : {
"type" : "string"
},
"type" : {
"type" : "string",
"enum" : [ "by_date", "by_time", "by_timestamp", "by_regex", "by_equality", "by_type", "by_null" ]
},
"value" : {
"type" : "string"
},
"predefined" : {
"type" : "string",
"enum" : [ "only_alpha_unicode", "number", "any_double", "any_boolean", "ip_address", "hostname", "email", "url", "uuid", "iso_date", "iso_date_time", "iso_time", "iso_8601_with_offset", "non_empty", "non_blank" ]
},
"minOccurrence" : {
"type" : "integer"
},
"maxOccurrence" : {
"type" : "integer"
},
"regexType" : {
"type" : "string",
"enum" : [ "as_integer", "as_double", "as_float", "as_long", "as_short", "as_boolean", "as_string" ]
}
}
}
},
"headers" : {
"type" : "array",
"items" : {
"type" : "object",
"$ref" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:KeyValueMatcher"
}
},
"queryParameters" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:QueryParameterMatcher",
"properties" : {
"key" : {
"type" : "string"
},
"type" : {
"type" : "string",
"enum" : [ "equal_to", "containing", "matching", "not_matching", "equal_to_json", "equal_to_xml", "absent", "binary_equal_to" ]
},
"value" : {
"type" : "object",
"$ref" : "urn:jsonschema:java:lang:Object"
}
}
}
},
"cookies" : {
"type" : "array",
"items" : {
"type" : "object",
"$ref" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:KeyValueMatcher"
}
},
"multipart" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:MultipartStubMatcher",
"properties" : {
"params" : {
"type" : "array",
"items" : {
"type" : "object",
"$ref" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:KeyValueMatcher"
}
},
"named" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:MultipartNamedStubMatcher",
"properties" : {
"paramName" : {
"type" : "string"
},
"fileName" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:ValueMatcher",
"properties" : {
"regex" : {
"type" : "string"
},
"predefined" : {
"type" : "string",
"enum" : [ "only_alpha_unicode", "number", "any_double", "any_boolean", "ip_address", "hostname", "email", "url", "uuid", "iso_date", "iso_date_time", "iso_time", "iso_8601_with_offset", "non_empty", "non_blank" ]
}
}
},
"fileContent" : {
"type" : "object",
"$ref" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:ValueMatcher"
},
"contentType" : {
"type" : "object",
"$ref" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:ValueMatcher"
}
}
}
}
}
}
}
},
"multipart" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:Multipart",
"properties" : {
"params" : {
"type" : "object",
"additionalProperties" : {
"type" : "string"
}
},
"named" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:Named",
"properties" : {
"paramName" : {
"type" : "string"
},
"fileName" : {
"type" : "string"
},
"fileContent" : {
"type" : "string"
},
"fileContentAsBytes" : {
"type" : "string"
},
"fileContentFromFileAsBytes" : {
"type" : "string"
},
"contentType" : {
"type" : "string"
},
"fileNameCommand" : {
"type" : "string"
},
"fileContentCommand" : {
"type" : "string"
},
"contentTypeCommand" : {
"type" : "string"
}
}
}
}
}
}
}
},
"response" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:Response",
"properties" : {
"status" : {
"type" : "integer"
},
"headers" : {
"type" : "object",
"additionalProperties" : {
"type" : "object",
"$ref" : "urn:jsonschema:java:lang:Object"
}
},
"cookies" : {
"type" : "object",
"additionalProperties" : {
"type" : "object",
"$ref" : "urn:jsonschema:java:lang:Object"
}
},
"body" : {
"type" : "object",
"$ref" : "urn:jsonschema:java:lang:Object"
},
"bodyFromFile" : {
"type" : "string"
},
"bodyFromFileAsBytes" : {
"type" : "string"
},
"matchers" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:TestMatchers",
"properties" : {
"body" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:BodyTestMatcher",
"properties" : {
"path" : {
"type" : "string"
},
"type" : {
"type" : "string",
"enum" : [ "by_date", "by_time", "by_timestamp", "by_regex", "by_equality", "by_type", "by_command", "by_null" ]
},
"value" : {
"type" : "string"
},
"minOccurrence" : {
"type" : "integer"
},
"maxOccurrence" : {
"type" : "integer"
},
"predefined" : {
"type" : "string",
"enum" : [ "only_alpha_unicode", "number", "any_double", "any_boolean", "ip_address", "hostname", "email", "url", "uuid", "iso_date", "iso_date_time", "iso_time", "iso_8601_with_offset", "non_empty", "non_blank" ]
},
"regexType" : {
"type" : "string",
"enum" : [ "as_integer", "as_double", "as_float", "as_long", "as_short", "as_boolean", "as_string" ]
}
}
}
},
"headers" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:TestHeaderMatcher",
"properties" : {
"key" : {
"type" : "string"
},
"regex" : {
"type" : "string"
},
"command" : {
"type" : "string"
},
"predefined" : {
"type" : "string",
"enum" : [ "only_alpha_unicode", "number", "any_double", "any_boolean", "ip_address", "hostname", "email", "url", "uuid", "iso_date", "iso_date_time", "iso_time", "iso_8601_with_offset", "non_empty", "non_blank" ]
},
"regexType" : {
"type" : "string",
"enum" : [ "as_integer", "as_double", "as_float", "as_long", "as_short", "as_boolean", "as_string" ]
}
}
}
},
"cookies" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:TestCookieMatcher",
"properties" : {
"key" : {
"type" : "string"
},
"regex" : {
"type" : "string"
},
"command" : {
"type" : "string"
},
"predefined" : {
"type" : "string",
"enum" : [ "only_alpha_unicode", "number", "any_double", "any_boolean", "ip_address", "hostname", "email", "url", "uuid", "iso_date", "iso_date_time", "iso_time", "iso_8601_with_offset", "non_empty", "non_blank" ]
},
"regexType" : {
"type" : "string",
"enum" : [ "as_integer", "as_double", "as_float", "as_long", "as_short", "as_boolean", "as_string" ]
}
}
}
}
}
},
"async" : {
"type" : "boolean"
},
"fixedDelayMilliseconds" : {
"type" : "integer"
}
}
},
"input" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:Input",
"properties" : {
"triggeredBy" : {
"type" : "string"
},
"assertThat" : {
"type" : "string"
}
}
},
"outputMessage" : {
"type" : "object",
"id" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:OutputMessage",
"properties" : {
"sentTo" : {
"type" : "string"
},
"headers" : {
"type" : "object",
"additionalProperties" : {
"type" : "object",
"$ref" : "urn:jsonschema:java:lang:Object"
}
},
"body" : {
"type" : "object",
"$ref" : "urn:jsonschema:java:lang:Object"
},
"bodyFromFile" : {
"type" : "string"
},
"bodyFromFileAsBytes" : {
"type" : "string"
},
"assertThat" : {
"type" : "string"
},
"matchers" : {
"type" : "object",
"$ref" : "urn:jsonschema:org:springframework:cloud:contract:verifier:converter:YamlContract:TestMatchers"
}
}
},
"description" : {
"type" : "string"
},
"label" : {
"type" : "string"
},
"name" : {
"type" : "string"
},
"priority" : {
"type" : "integer"
},
"ignored" : {
"type" : "boolean"
},
"inProgress" : {
"type" : "boolean"
},
"metadata" : {
"type" : "object",
"additionalProperties" : {
"type" : "object",
"$ref" : "urn:jsonschema:java:lang:Object"
}
}
}
}

View File

@@ -0,0 +1,30 @@
.Docker environment variables
|===
|Name | Description | Default
|ADDITIONAL_FLAGS|(Docker Image only) Additional flags to be passed to the Gradle build|
|DEBUG|(Docker Image only) Applicable for Docker Image - turns on debug mode for the Gradle build|false
|EXTERNAL_CONTRACTS_ARTIFACT_ID|Artifact ID of the project with contracts|
|EXTERNAL_CONTRACTS_CLASSIFIER|Classifier of the project with contracts|
|EXTERNAL_CONTRACTS_GROUP_ID|Group ID of the project with contracts|com.example
|EXTERNAL_CONTRACTS_PATH|Path to contracts for the given project, inside the project with contracts. Defaults to slash-separated `EXTERNAL_CONTRACTS_GROUP_ID` concatenated with `/` and `EXTERNAL_CONTRACTS_ARTIFACT_ID. For example,
for group id `cat-server-side.dog` and artifact ID `fish`, would result in `cat/dog/fish` for the contracts path.|
|EXTERNAL_CONTRACTS_REPO_WITH_BINARIES_PASSWORD|(optional) Password if the `EXTERNAL_CONTRACTS_REPO_WITH_BINARIES_URL` requires authentication. It defaults to `REPO_WITH_BINARIES_PASSWORD, If that is not set, it defaults to `password|
|EXTERNAL_CONTRACTS_REPO_WITH_BINARIES_URL|URL of your Artifact Manager. It defaults to the value of `REPO_WITH_BINARIES_URL` environment variable and if that is not set, it defaults to `http://localhost:8081/artifactory/libs-release-local`|
|EXTERNAL_CONTRACTS_REPO_WITH_BINARIES_USERNAME|(optional) Username if the `EXTERNAL_CONTRACTS_REPO_WITH_BINARIES_URL` requires authentication. It defaults to `REPO_WITH_BINARIES_USERNAME`. If that is not set, it defaults to `admin|
|EXTERNAL_CONTRACTS_VERSION|Version of the project with contracts. Defautls to an equivalent of picking the latest|+
|EXTERNAL_CONTRACTS_WORK_OFFLINE|If set to `true`, retrieves the artifact with contracts from the container's `.m2`. Mount your local `.m2` as a volume available at the container's `/root/.m2` path|false
|FAIL_ON_NO_CONTRACTS|Should the build fail if there are no contracts present?|false
|MESSAGING_TYPE|Type of messaging. Can be either [rabbit] or [kafka].|
|PRODUCER_STUBS_CLASSIFIER|Archive classifier used for generated producer stubs|stubs
|PROJECT_GROUP|Your project's group ID|com.example
|PROJECT_NAME|Your project's artifact id|example
|PROJECT_VERSION|Your project's version|0.0.1-SNAPSHOT
|PUBLISH_ARTIFACTS|If set to `true`, publishes the artifact to binary storage|true
|PUBLISH_ARTIFACTS_OFFLINE|If set to `true`, publishes the artifacts to local m2|false
|PUBLISH_STUBS_TO_SCM|If set to `true` will run the task to publish stubs to scm|false
|REPO_ALLOW_INSECURE_PROTOCOL|(optional) If <true> allows to publish artifacts to Artifact Manager over insecure HTTP|false
|REPO_WITH_BINARIES_PASSWORD|(optional) Password when the Artifact Manager is secured|password
|REPO_WITH_BINARIES_URL|URL of your Artifact Manager (defaults to the default URL of https://jfrog.com/artifactory/[Artifactory] when running locally)|http://localhost:8081/artifactory/libs-release-local
|REPO_WITH_BINARIES_USERNAME|(optional) Username when the Artifact Manager is secured|admin
|STANDALONE_PROTOCOL|For standalone version, which additional protocol should be added|
|===