Sync docs from master to gh-pages
This commit is contained in:
@@ -4344,7 +4344,7 @@ such as <literal>named("fileName", "fileContent")</literal>, or via a map notati
|
||||
},
|
||||
"response" : {
|
||||
"status" : 200,
|
||||
"transformers" : [ "response-template" ]
|
||||
"transformers" : [ "response-template", "foo-transformer" ]
|
||||
}
|
||||
}
|
||||
'''</programlisting>
|
||||
@@ -4895,6 +4895,28 @@ proper values. Additionally, it registers two helper functions:</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section xml:id="_registering_your_own_wiremock_extension">
|
||||
<title>Registering Your Own WireMock Extension</title>
|
||||
<simpara>WireMock lets you register custom extensions. By default, Spring Cloud Contract registers
|
||||
the transformer, which lets you reference a request from a response. If you want to
|
||||
provide your own extensions, you can register an implementation of the
|
||||
<literal>org.springframework.cloud.contract.verifier.dsl.wiremock.WireMockExtensions</literal> interface.
|
||||
Since we use the spring.factories extension approach, you can create an entry in
|
||||
<literal>META-INF/spring.factories</literal> file similar to the following:</simpara>
|
||||
<programlisting language="groovy" linenumbering="unnumbered">org.springframework.cloud.contract.verifier.dsl.wiremock.WireMockExtensions=\
|
||||
org.springframework.cloud.contract.stubrunner.provider.wiremock.TestWireMockExtensions</programlisting>
|
||||
<simpara>The following is an example of a custom extension:</simpara>
|
||||
<formalpara>
|
||||
<title>TestWireMockExtensions.groovy</title>
|
||||
<para>
|
||||
<programlisting language="groovy" linenumbering="unnumbered">Unresolved directive in verifier_contract.adoc - include::../../../../spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/verifier/dsl/wiremock/TestWireMockExtensions.groovy[indent=0]</programlisting>
|
||||
</para>
|
||||
</formalpara>
|
||||
<important>
|
||||
<simpara>Remember to override the <literal>applyGlobally()</literal> method and set it to <literal>false</literal> if you
|
||||
want the transformation to be applied only for a mapping that explicitly requires it.</simpara>
|
||||
</important>
|
||||
</section>
|
||||
<section xml:id="_dynamic_properties_in_the_matchers_sections">
|
||||
<title>Dynamic Properties in the Matchers Sections</title>
|
||||
<simpara>If you work with <link xl:href="https://docs.pact.io/">Pact</link>, the following discussion may seem familiar.
|
||||
@@ -5946,7 +5968,12 @@ implementation.</simpara>
|
||||
<simpara>The following example shows a typical <literal>spring.factories</literal> file:</simpara>
|
||||
<screen># Converters
|
||||
org.springframework.cloud.contract.spec.ContractConverter=\
|
||||
org.springframework.cloud.contract.verifier.converter.YamlContractConverter</screen>
|
||||
org.springframework.cloud.contract.verifier.converter.YamlContractConverter
|
||||
|
||||
# tag::extension[]
|
||||
org.springframework.cloud.contract.verifier.dsl.wiremock.WireMockExtensions=\
|
||||
org.springframework.cloud.contract.verifier.dsl.wiremock.TestWireMockExtensions
|
||||
# end::extension[]</screen>
|
||||
<simpara>The following example shows a typical YAML implementation that matches the preceding
|
||||
example:</simpara>
|
||||
<programlisting language="groovy" linenumbering="unnumbered">package org.springframework.cloud.contract.verifier.converter
|
||||
|
||||
Reference in New Issue
Block a user