Fixed broken docs

This commit is contained in:
Marcin Grzejszczak
2022-07-01 14:02:32 +02:00
parent 8a855d9bc3
commit 414cd9c545
10 changed files with 79 additions and 31 deletions

View File

@@ -27,12 +27,13 @@
:stubrunner_core_path: {core_path}/spring-cloud-contract-stub-runner
:standalone_samples_path: {samples_path}/standalone/dsl
:standalone_messaging_samples_path: {samples_path}/standalone/dsl
:standalone_pact_path: {samples_path}/standalone/dsl
:standalone_restdocs_path: {samples_path}/standalone/restdocs
:tests_path: {core_path}/tests
:samples_branch: 3.1.x
: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}/
:samples_code: https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/{samples_branch}
:doc_samples: {samples_code}/wiremock-jetty
:doc_samples_url: {samples_url}/wiremock-jetty
:wiremock_tests: {core_path}/spring-cloud-contract-wiremock
:introduction_url: {core_path}
:standalone_pact_path: {samples_url}/

View File

@@ -1874,7 +1874,7 @@ The XPath expression to select the email address is
WARNING: Beware, as the unqualified expressions (`/customer/email/text()` or `*/[local-name()='customer' and namespace-uri()='http://demo.com/customer']/email/text()`)
result in `""`. Even the child elements have to be referenced with the `local-name` syntax.
====== General Namespaced Node Expression Syntax
===== General Namespaced Node Expression Syntax
- Node using qualified namespace:
```
/<node-name>
@@ -2062,4 +2062,4 @@ name of `scenario1` and the three following steps:
. `logout`, marked as `Step2` (which closes the scenario).
You can find more details about WireMock scenarios at
https://wiremock.org/docs/stateful-behaviour/[https://wiremock.org/docs/stateful-behaviour/].
https://wiremock.org/docs/stateful-behaviour/[https://wiremock.org/docs/stateful-behaviour/].

View File

@@ -23,9 +23,9 @@ include::{standalone_samples_path}/http-server/pom.xml[tags=repos,indent=0]
----
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Gradle
.Gradle (`settings.xml`)
----
include::{standalone_samples_path}/http-server/build.gradle[tags=repos,indent=0]
include::{standalone_samples_path}/http-server/settings.gradle[tags=repos,indent=0]
----
====

View File

@@ -16,8 +16,8 @@ your test. The following code shows an example:
====
[source,java,indent=0]
----
include::{doc_samples}/src/test/java/com/example/WiremockForDocsTests.java[tags=wiremock_test1]
include::{doc_samples}/src/test/java/com/example/WiremockForDocsTests.java[tags=wiremock_test2]
include::{doc_samples_url}/src/test/java/com/example/WiremockForDocsTests.java[tags=wiremock_test1]
include::{doc_samples_url}/src/test/java/com/example/WiremockForDocsTests.java[tags=wiremock_test2]
----
====
@@ -111,8 +111,8 @@ instance, as the following example shows:
====
[source,java,indent=0]
----
include::{doc_samples}/src/test/java/com/example/WiremockForDocsClassRuleTests.java[tags=wiremock_test1]
include::{doc_samples}/src/test/java/com/example/WiremockForDocsClassRuleTests.java[tags=wiremock_test2]
include::{doc_samples_url}/src/test/java/com/example/WiremockForDocsClassRuleTests.java[tags=wiremock_test1]
include::{doc_samples_url}/src/test/java/com/example/WiremockForDocsClassRuleTests.java[tags=wiremock_test2]
----
====
@@ -182,7 +182,7 @@ a Spring `MockRestServiceServer`. The following code shows an example:
====
[source,java,indent=0]
----
include::{doc_samples}/src/test/java/com/example/WiremockForDocsMockServerApplicationTests.java[tags=wiremock_test]
include::{doc_samples_url}/src/test/java/com/example/WiremockForDocsMockServerApplicationTests.java[tags=wiremock_test]
----
====

View File

@@ -872,14 +872,7 @@ set a `metaData` entry in the Pact file with the `sentTo` key equal to the desti
=== Pact Contract
Spring Cloud Contract can read the Pact JSON definition. You can place the file in the
`src/test/resources/contracts` folder. Remember to put the `spring-cloud-contract-pact` dependency to your classpath. The following example shows such a Pact contract:
====
[source,javascript,indent=0]
----
include::{standalone_pact_path}/http-server/src/test/resources/contracts/pact/shouldMarkClientAsFraud.json[indent=0]
----
====
`src/test/resources/contracts` folder. Remember to put the `spring-cloud-contract-pact` dependency to your classpath.
[[how-to-use-pact-broker-pact-for-producers]]
=== Pact for Producers
@@ -893,13 +886,13 @@ Maven and Gradle:
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
.Maven
----
include::{standalone_pact_path}/http-server/pom.xml[tags=pact_dependency,indent=0]
include::{standalone_pact_path}/producer_pact/pom.xml[tags=pact_dependency,indent=0]
----
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Gradle
----
include::{standalone_pact_path}/http-server/build.gradle[tags=pact_dependency,indent=0]
include::{standalone_pact_path}/producer_pact/build.gradle[tags=pact_dependency,indent=0]
----
====
@@ -976,13 +969,13 @@ Maven and Gradle:
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
.Maven
----
include::{standalone_pact_path}/http-client/pom.xml[tags=pact_dependency,indent=0]
include::{standalone_pact_path}/consumer_pact_stubrunner/pom.xml[tags=pact_dependency,indent=0]
----
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Gradle
----
include::{standalone_pact_path}/http-client/build.gradle[tags=pact_dependency,indent=0]
include::{standalone_pact_path}/consumer_pact_stubrunner/build.gradle[tags=pact_dependency,indent=0]
----
====

View File

@@ -1,4 +1,4 @@
// tag:repos[]
// tag::repos[]
pluginManagement {
repositories {
mavenLocal()
@@ -7,7 +7,7 @@ pluginManagement {
maven { url "https://repo.spring.io/release" }
gradlePluginPortal()
}
// end:repos[]
// end::repos[]
plugins {
id "org.springframework.boot" version "${bootVersion}"
id "io.spring.dependency-management" version "1.0.10.RELEASE"

View File

@@ -1,4 +1,3 @@
/*
* Copyright 2013-2020 the original author or authors.
*
@@ -27,7 +26,6 @@ import org.springframework.cloud.contract.spec.internal.DslProperty;
import org.springframework.cloud.contract.spec.internal.Request;
import org.springframework.cloud.contract.verifier.util.ContractVerifierUtil;
// tag::class[]
class contract_multipart implements Supplier<Collection<Contract>> {
private static Map<String, DslProperty> namedProps(Request r) {

View File

@@ -1,4 +1,3 @@
/*
* Copyright 2013-2020 the original author or authors.
*
@@ -23,7 +22,6 @@ import java.util.function.Supplier;
import org.springframework.cloud.contract.spec.Contract;
import org.springframework.cloud.contract.verifier.util.ContractVerifierUtil;
// tag::class[]
class contract_rest implements Supplier<Collection<Contract>> {
@Override

View File

@@ -1,4 +1,3 @@
/*
* Copyright 2013-2020 the original author or authors.
*
@@ -22,7 +21,6 @@ import java.util.function.Supplier;
import org.springframework.cloud.contract.spec.Contract;
// tag::class[]
class contract_rest_from_file implements Supplier<Collection<Contract>> {
@Override

View File

@@ -31,6 +31,7 @@ import spock.util.concurrent.PollingConditions
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.cloud.contract.spec.Contract
import org.springframework.cloud.contract.stubrunner.StubFinder
import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner
import org.springframework.context.annotation.Bean
@@ -278,4 +279,63 @@ class KafkaStubRunnerSpec extends Specification {
return this.output
}
}
Contract dsl =
// tag::sample_dsl[]
Contract.make {
label 'return_book_1'
input {
triggeredBy('bookReturnedTriggered()')
}
outputMessage {
sentTo('output')
body('''{ "bookName" : "foo" }''')
headers {
header('BOOK-NAME', 'foo')
}
}
}
// end::sample_dsl[]
Contract dsl2 =
// tag::sample_dsl_2[]
Contract.make {
label 'return_book_2'
input {
messageFrom('input')
messageBody([
bookName: 'foo'
])
messageHeaders {
header('sample', 'header')
}
}
outputMessage {
sentTo('output')
body([
bookName: 'foo'
])
headers {
header('BOOK-NAME', 'foo')
}
}
}
// end::sample_dsl_2[]
Contract dsl3 =
// tag::sample_dsl_3[]
Contract.make {
label 'delete_book'
input {
messageFrom('delete')
messageBody([
bookName: 'foo'
])
messageHeaders {
header('sample', 'header')
}
assertThat('bookWasDeleted()')
}
}
// end::sample_dsl_3[]
}