Sync docs from master to gh-pages

This commit is contained in:
buildmaster
2018-03-31 16:23:56 +00:00
parent f2dcccd216
commit c2e704b909
16 changed files with 1426 additions and 153 deletions

View File

@@ -1,6 +1,7 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>12.&nbsp;Migrations</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="up" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="prev" href="multi__spring_cloud_contract_wiremock.html" title="11.&nbsp;Spring Cloud Contract WireMock"><link rel="next" href="multi__links.html" title="13.&nbsp;Links"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">12.&nbsp;Migrations</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__spring_cloud_contract_wiremock.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__links.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_migrations" href="#_migrations"></a>12.&nbsp;Migrations</h1></div></div></div><p>This section covers migrating from one version of Spring Cloud Contract Verifier to the
<title>12.&nbsp;Migrations</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="up" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="prev" href="multi__spring_cloud_contract_wiremock.html" title="11.&nbsp;Spring Cloud Contract WireMock"><link rel="next" href="multi__links.html" title="13.&nbsp;Links"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">12.&nbsp;Migrations</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__spring_cloud_contract_wiremock.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__links.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_migrations" href="#_migrations"></a>12.&nbsp;Migrations</h1></div></div></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>For up to date migration guides please visit
the project&#8217;s <a class="link" href="https://github.com/spring-cloud/spring-cloud-contract/wiki/" target="_top">wiki page</a>.</p></td></tr></table></div><p>This section covers migrating from one version of Spring Cloud Contract Verifier to the
next version. It covers the following versions upgrade paths:</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cloud-verifier-1.0-1.1" href="#cloud-verifier-1.0-1.1"></a>12.1&nbsp;1.0.x &#8594; 1.1.x</h2></div></div></div><p>This section covers upgrading from version 1.0 to version 1.1.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_new_structure_of_generated_stubs" href="#_new_structure_of_generated_stubs"></a>12.1.1&nbsp;New structure of generated stubs</h3></div></div></div><p>In <code class="literal">1.1.x</code> we have introduced a change to the structure of generated stubs. If you have
been using the <code class="literal">@AutoConfigureWireMock</code> notation to use the stubs from the classpath,
it no longer works. The following example shows how the <code class="literal">@AutoConfigureWireMock</code> notation

View File

@@ -1,8 +1,8 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>3.&nbsp;Spring Cloud Contract FAQ</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="up" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="prev" href="multi__spring_cloud_contract_verifier_introduction.html" title="2.&nbsp;Spring Cloud Contract Verifier Introduction"><link rel="next" href="multi__spring_cloud_contract_verifier_setup.html" title="4.&nbsp;Spring Cloud Contract Verifier Setup"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.&nbsp;Spring Cloud Contract FAQ</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__spring_cloud_contract_verifier_introduction.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__spring_cloud_contract_verifier_setup.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_spring_cloud_contract_faq" href="#_spring_cloud_contract_faq"></a>3.&nbsp;Spring Cloud Contract FAQ</h1></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_why_use_spring_cloud_contract_verifier_and_not_x" href="#_why_use_spring_cloud_contract_verifier_and_not_x"></a>3.1&nbsp;Why use Spring Cloud Contract Verifier and not X ?</h2></div></div></div><p>For the time being Spring Cloud Contract Verifier is a JVM based tool. So it could be your first pick when you&#8217;re already creating
<title>3.&nbsp;Spring Cloud Contract FAQ</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="up" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="prev" href="multi__spring_cloud_contract_verifier_introduction.html" title="2.&nbsp;Spring Cloud Contract Verifier Introduction"><link rel="next" href="multi__spring_cloud_contract_verifier_setup.html" title="4.&nbsp;Spring Cloud Contract Verifier Setup"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.&nbsp;Spring Cloud Contract FAQ</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__spring_cloud_contract_verifier_introduction.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__spring_cloud_contract_verifier_setup.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_spring_cloud_contract_faq" href="#_spring_cloud_contract_faq"></a>3.&nbsp;Spring Cloud Contract FAQ</h1></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_why_use_spring_cloud_contract_verifier_and_not_x" href="#_why_use_spring_cloud_contract_verifier_and_not_x"></a>3.1&nbsp;Why use Spring Cloud Contract Verifier and not X ?</h2></div></div></div><p>For the time being Spring Cloud Contract is a JVM based tool. So it could be your first pick when you&#8217;re already creating
software for the JVM. This project has a lot of really interesting features but especially quite a few of them definitely make
Spring Cloud Contract Verifier stand out on the "market" of Consumer Driven Contract (CDC) tooling. Out of many the most interesting are:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Possibility to do CDC with messaging</li><li class="listitem">Clear and easy to use, statically typed DSL</li><li class="listitem">Possibility to copy paste your current JSON file to the contract and only edit its elements</li><li class="listitem">Automatic generation of tests from the defined Contract</li><li class="listitem">Stub Runner functionality - the stubs are automatically downloaded at runtime from Nexus / Artifactory</li><li class="listitem">Spring Cloud integration - no discovery service is needed for integration tests</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_i_don_t_want_to_write_a_contract_in_groovy" href="#_i_don_t_want_to_write_a_contract_in_groovy"></a>3.2&nbsp;I don&#8217;t want to write a contract in Groovy!</h2></div></div></div><p>No problem. You can write a contract in YAML!</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_what_is_this_value_consumer_producer" href="#_what_is_this_value_consumer_producer"></a>3.3&nbsp;What is this value(consumer(), producer()) ?</h2></div></div></div><p>One of the biggest challenges related to stubs is their reusability. Only if they can be vastly used, will they serve their purpose.
Spring Cloud Contract Verifier stand out on the "market" of Consumer Driven Contract (CDC) tooling. Out of many the most interesting are:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Possibility to do CDC with messaging</li><li class="listitem">Clear and easy to use, statically typed DSL</li><li class="listitem">Possibility to copy paste your current JSON file to the contract and only edit its elements</li><li class="listitem">Automatic generation of tests from the defined Contract</li><li class="listitem">Stub Runner functionality - the stubs are automatically downloaded at runtime from Nexus / Artifactory</li><li class="listitem">Spring Cloud integration - no discovery service is needed for integration tests</li><li class="listitem">Spring Cloud Contract integrates with Pact out of the box and provides easy hooks to extend its functionality</li><li class="listitem">Via Docker adds support for any language &amp; framework used</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_i_don_t_want_to_write_a_contract_in_groovy" href="#_i_don_t_want_to_write_a_contract_in_groovy"></a>3.2&nbsp;I don&#8217;t want to write a contract in Groovy!</h2></div></div></div><p>No problem. You can write a contract in YAML!</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_what_is_this_value_consumer_producer" href="#_what_is_this_value_consumer_producer"></a>3.3&nbsp;What is this value(consumer(), producer()) ?</h2></div></div></div><p>One of the biggest challenges related to stubs is their reusability. Only if they can be vastly used, will they serve their purpose.
What typically makes that difficult are the hard-coded values of request / response elements. For example dates or ids.
Imagine the following JSON request</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"time"</span> : <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"2016-10-10 20:10:15"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span>
@@ -82,7 +82,7 @@ It can be related to security issues where the consumers can&#8217;t clone the p
contracts in a single place then you, as a producer, will know how many consumers you have and which
consumer will you break with your local changes.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_repo_structure" href="#_repo_structure"></a>3.5.1&nbsp;Repo structure</h3></div></div></div><p>Let&#8217;s assume that we have a producer with coordinates <code class="literal">com.example:server</code> and 3 consumers: <code class="literal">client1</code>,
<code class="literal">client2</code>, <code class="literal">client3</code>. Then in the repository with common contracts you would have the following setup
(which you can checkout <a class="link" href="https://github.com/spring-cloud/spring-cloud-contract/tree/1.0.x/samples/standalone/contracts" target="_top">here</a>:</p><pre class="programlisting">&#9500;&#9472;&#9472; com
(which you can checkout <a class="link" href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples/standalone/contracts" target="_top">here</a>):</p><pre class="programlisting">&#9500;&#9472;&#9472; com
&#9474;&nbsp;&nbsp; &#9492;&#9472;&#9472; example
&#9474;&nbsp;&nbsp; &#9492;&#9472;&#9472; server
&#9474;&nbsp;&nbsp; &#9500;&#9472;&#9472; client1
@@ -115,15 +115,15 @@ one to one to the contents of the repo.</p><p>Example of a <code class="literal"
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;parent&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;groupId&gt;</span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/groupId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;artifactId&gt;</span>spring-boot-starter-parent<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/artifactId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;version&gt;</span>1.5.10.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;version&gt;</span>2.0.0.BUILD-SNAPSHOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;relativePath /&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/parent&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;properties&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;project.build.sourceEncoding&gt;</span>UTF-8<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/project.build.sourceEncoding&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;java.version&gt;</span>1.8<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/java.version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;spring-cloud-contract.version&gt;</span>1.2.5.BUILD-SNAPSHOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/spring-cloud-contract.version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;spring-cloud-dependencies.version&gt;</span>Edgware.BUILD-SNAPSHOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/spring-cloud-dependencies.version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;spring-cloud-contract.version&gt;</span>2.0.0.BUILD-SNAPSHOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/spring-cloud-contract.version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;spring-cloud-dependencies.version&gt;</span>Finchley.BUILD-SNAPSHOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/spring-cloud-dependencies.version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;excludeBuildFolders&gt;</span>true<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/excludeBuildFolders&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/properties&gt;</span>
@@ -280,6 +280,7 @@ of the JAR containing the contracts:</p><pre class="programlisting"><span xmlns:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;groupId&gt;</span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/groupId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;artifactId&gt;</span>spring-cloud-contract-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/artifactId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;configuration&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;contractsMode&gt;</span>REMOTE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/contractsMode&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;contractsRepositoryUrl&gt;</span>http://link/to/your/nexus/or/artifactory/or/sth<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/contractsRepositoryUrl&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;contractDependency&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;groupId&gt;</span>com.example.standalone<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/groupId&gt;</span>
@@ -388,20 +389,126 @@ configurations {
include: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"**/*"</span>,
excludes: [
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"**/${project.name}/**"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">",
</span> **/${first-topic}<strong class="hl-tag" style="color: blue">/**",
**/</strong>${second-topic}<strong class="hl-tag" style="color: blue">/**])
}</strong></pre><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Create task dependencies:</li></ul></div><pre class="programlisting">unzipContracts.dependsOn(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"getContracts"</span>)
</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"**/${first-topic}/**"</span>,
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"**/${second-topic}/**"</span>])
}</pre><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Create task dependencies:</li></ul></div><pre class="programlisting">unzipContracts.dependsOn(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"getContracts"</span>)
deleteUnwantedContracts.dependsOn(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"unzipContracts"</span>)
build.dependsOn(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"deleteUnwantedContracts"</span>)</pre><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Configure plugin by specifying the directory containing contracts using <code class="literal"><code class="literal">contractsDslDir</code></code> property</li></ul></div><pre class="programlisting">contracts {
build.dependsOn(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"deleteUnwantedContracts"</span>)</pre><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Configure plugin by specifying the directory containing contracts using <code class="literal">contractsDslDir</code> property</li></ul></div><pre class="programlisting">contracts {
contractsDslDir = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> File(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"${buildDir}/unpackedContracts"</span>)
}</pre></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_can_i_have_multiple_base_classes_for_tests" href="#_can_i_have_multiple_base_classes_for_tests"></a>3.6&nbsp;Can I have multiple base classes for tests?</h2></div></div></div><p>Yes! Check out the <a class="link" href="https://cloud.spring.io/spring-cloud-contract/spring-cloud-contract.html#_different_base_classes_for_contracts" target="_top">Different base classes for contracts</a> sections
of either Gradle or Maven plugins.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_how_can_i_debug_the_request_response_being_sent_by_the_generated_tests_client" href="#_how_can_i_debug_the_request_response_being_sent_by_the_generated_tests_client"></a>3.7&nbsp;How can I debug the request/response being sent by the generated tests client?</h2></div></div></div><p>The generated tests all boil down to RestAssured in some form or fashion which relies on <a class="link" href="https://hc.apache.org/httpcomponents-client-ga/" target="_top">Apache HttpClient</a>. HttpClient has a facility called <a class="link" href="https://hc.apache.org/httpcomponents-client-ga/logging.html#Wire_Logging" target="_top">wire logging</a> which logs the entire request and response to HttpClient. Spring Boot has a logging <a class="link" href="https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html" target="_top">common application property</a> for doing this sort of thing, just add this to your application properties</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.level.org.apache.http.wire</span>=DEBUG</pre><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_how_can_i_debug_the_mapping_request_response_being_sent_by_wiremock" href="#_how_can_i_debug_the_mapping_request_response_being_sent_by_wiremock"></a>3.7.1&nbsp;How can I debug the mapping/request/response being sent by WireMock?</h3></div></div></div><p>Starting from version <code class="literal">1.2.0</code> we turn on WireMock logging to
}</pre></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_do_i_need_a_binary_storage_can_t_i_use_git" href="#_do_i_need_a_binary_storage_can_t_i_use_git"></a>3.6&nbsp;Do I need a Binary Storage? Can&#8217;t I use Git?</h2></div></div></div><p>In the polyglot world, there are languages that don&#8217;t use binary storages like
Artifactory or Nexus. Starting from Spring Cloud Contract version 2.0.0 we provide
mechanisms to store contracts and stubs in a SCM repository. Currently the
only supported SCM is Git.</p><p>The repository would have to the following setup
(which you can checkout <a class="link" href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/2.0.x/contracts_git/" target="_top">here</a>):</p><pre class="screen">.
&#9492;&#9472;&#9472; META-INF
&#9492;&#9472;&#9472; com.example
&#9492;&#9472;&#9472; beer-api-producer-git
&#9492;&#9472;&#9472; 0.0.1-SNAPSHOT
&#9500;&#9472;&#9472; contracts
&#9474;&nbsp;&nbsp; &#9492;&#9472;&#9472; beer-api-consumer
&#9474;&nbsp;&nbsp; &#9500;&#9472;&#9472; messaging
&#9474;&nbsp;&nbsp; &#9474;&nbsp;&nbsp; &#9500;&#9472;&#9472; shouldSendAcceptedVerification.groovy
&#9474;&nbsp;&nbsp; &#9474;&nbsp;&nbsp; &#9492;&#9472;&#9472; shouldSendRejectedVerification.groovy
&#9474;&nbsp;&nbsp; &#9492;&#9472;&#9472; rest
&#9474;&nbsp;&nbsp; &#9500;&#9472;&#9472; shouldGrantABeerIfOldEnough.groovy
&#9474;&nbsp;&nbsp; &#9492;&#9472;&#9472; shouldRejectABeerIfTooYoung.groovy
&#9492;&#9472;&#9472; mappings
&#9492;&#9472;&#9472; beer-api-consumer
&#9492;&#9472;&#9472; rest
&#9500;&#9472;&#9472; shouldGrantABeerIfOldEnough.json
&#9492;&#9472;&#9472; shouldRejectABeerIfTooYoung.json</pre><p>Under <code class="literal">META-INF</code> folder:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">we group applications via <code class="literal">groupId</code> (e.g. <code class="literal">com.example</code>)</li><li class="listitem">then each application is represented via the <code class="literal">artifactId</code> (e.g. <code class="literal">beer-api-producer-git</code>)</li><li class="listitem">next, the version of the application. The version is mandatory! (e.g. <code class="literal">0.0.1-SNAPSHOT</code>)</li><li class="listitem"><p class="simpara">finally, there are two folders:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><code class="literal">contracts</code> - the good practice is to store the contracts required by each
consumer in the folder with the consumer name (e.g. <code class="literal">beer-api-consumer</code>). That way you
can use the <code class="literal">stubs-per-consumer</code> feature. Further directory structure is arbitrary.</li><li class="listitem"><code class="literal">mappings</code> - in this folder the Maven / Gradle Spring Cloud Contract plugins will push
the stub server mappings. On the consumer side, Stub Runner will scan this folder
to start stub servers with stub definitions. The folder structure will be a copy
of the one created in the <code class="literal">contracts</code> subfolder.</li></ul></div></li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_protocol_convention" href="#_protocol_convention"></a>3.6.1&nbsp;Protocol convention</h3></div></div></div><p>In order to control the type and location of the source of contracts (whether it&#8217;s
a binary storage or an SCM repository), you can use the protocol in the URL of
the repository. Spring Cloud Contract iterates over registered protocol resolvers
and tries to fetch the contracts (via a plugin) or stubs (via Stub Runner).</p><p>For the SCM functionality, currently, we support the Git repository. To use it,
in the property, where the repository URL needs to be placed you just have to prefix
the connection URL with <code class="literal">git://</code>. Here you can find a couple of examples:</p><pre class="screen">git://file:///foo/bar
git://https://github.com/spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git
git://git@github.com:spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_producer_2" href="#_producer_2"></a>3.6.2&nbsp;Producer</h3></div></div></div><p>For the producer, to use the SCM approach, we can reuse the
same mechanism we use for external contracts. We route Spring Cloud Contract
to use the SCM implementation via the URL that contains
the <code class="literal">git://</code> protocol.</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png"></td><th align="left">Important</th></tr><tr><td align="left" valign="top"><p>You have to manually add the <code class="literal">pushStubsToScm</code>
goal in Maven or execute (bind) the <code class="literal">pushStubsToScm</code> task in
Gradle. We don&#8217;t push stubs to <code class="literal">origin</code> of your git
repository out of the box.</p></td></tr></table></div><p><b>Maven.&nbsp;</b>
</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;plugin&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;groupId&gt;</span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/groupId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;artifactId&gt;</span>spring-cloud-contract-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/artifactId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;version&gt;</span>${spring-cloud-contract.version}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;extensions&gt;</span>true<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/extensions&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;configuration&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">&lt;!-- Base class mappings etc. --&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">&lt;!-- We want to pick contracts from a Git repository --&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;contractsRepositoryUrl&gt;</span>git://https://github.com/spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/contractsRepositoryUrl&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">&lt;!-- We reuse the contract dependency section to set up the path
to the folder that contains the contract definitions. In our case the
path will be /groupId/artifactId/version/contracts --&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;contractDependency&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;groupId&gt;</span>${project.groupId}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/groupId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;artifactId&gt;</span>${project.artifactId}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/artifactId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;version&gt;</span>${project.version}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/contractDependency&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">&lt;!-- The contracts mode can't be classpath --&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;contractsMode&gt;</span>REMOTE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/contractsMode&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/configuration&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;executions&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;execution&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;phase&gt;</span>package<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/phase&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;goals&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">&lt;!-- By default we will not push the stubs back to SCM,
you have to explicitly add it as a goal --&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;goal&gt;</span>pushStubsToScm<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/goal&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/goals&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/execution&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/executions&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/plugin&gt;</span></pre><p>
</p><p><b>Gradle.&nbsp;</b>
</p><pre class="programlisting">contracts {
// We want to pick contracts from a Git repository
contractDependency {
stringNotation = "${project.group}:${project.name}:${project.version}"
}
/*
We reuse the contract dependency section to set up the path
to the folder that contains the contract definitions. In our case the
path will be /groupId/artifactId/version/contracts
*/
contractRepository {
repositoryUrl = "git://https://github.com/spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git"
}
// The mode can't be classpath
contractsMode = "REMOTE"
// Base class mappings etc.
}
/*
In this scenario we want to publish stubs to SCM whenever
the `publish` task is executed
*/
publish.dependsOn("publishStubsToScm")</pre><p>
</p><p>With such a setup:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Git project will be cloned to a temporary directory</li><li class="listitem">The SCM stub downloader will go to <code class="literal">META-INF/groupId/artifactId/version/contracts</code> folder
to find contracts. E.g. for <code class="literal">com.example:foo:1.0.0</code> the path would be
<code class="literal">META-INF/com.example/foo/1.0.0/contracts</code></li><li class="listitem">Tests will be generated from the contracts</li><li class="listitem">Stubs will be created from the contracts</li><li class="listitem">Once the tests pass, the stubs will be committed in the cloned repository</li><li class="listitem">Finally, a push will be done to that repo&#8217;s <code class="literal">origin</code></li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_consumer_2" href="#_consumer_2"></a>3.6.3&nbsp;Consumer</h3></div></div></div><p>On the consumer side when passing the <code class="literal">repositoryRoot</code> parameter,
either from the <code class="literal">@AutoConfigureStubRunner</code> annotation, the
JUnit rule or properties, it&#8217;s enough to pass the URL of the
SCM repository, prefixed with the protocol. For example</p><pre class="programlisting">@AutoConfigureStubRunner(
stubsMode=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"REMOTE"</span>,
repositoryRoot=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"git://https://github.com/spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git"</span>,
ids=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"com.example:bookstore:0.0.1.RELEASE"</span>
)</pre><p>With such a setup:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Git project will be cloned to a temporary directory</li><li class="listitem">The SCM stub downloader will go to <code class="literal">META-INF/groupId/artifactId/version/</code> folder
to find stub definitions and contracts. E.g. for <code class="literal">com.example:foo:1.0.0</code> the path would be
<code class="literal">META-INF/com.example/foo/1.0.0/</code></li><li class="listitem">Stub servers will be started and fed with mappings</li><li class="listitem">Messaging definitions will be read and used in the messaging tests</li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_how_can_i_debug_the_request_response_being_sent_by_the_generated_tests_client" href="#_how_can_i_debug_the_request_response_being_sent_by_the_generated_tests_client"></a>3.7&nbsp;How can I debug the request/response being sent by the generated tests client?</h2></div></div></div><p>The generated tests all boil down to RestAssured in some form or fashion which relies on <a class="link" href="https://hc.apache.org/httpcomponents-client-ga/" target="_top">Apache HttpClient</a>. HttpClient has a facility called <a class="link" href="https://hc.apache.org/httpcomponents-client-ga/logging.html#Wire_Logging" target="_top">wire logging</a> which logs the entire request and response to HttpClient. Spring Boot has a logging <a class="link" href="https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html" target="_top">common application property</a> for doing this sort of thing, just add this to your application properties</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.level.org.apache.http.wire</span>=DEBUG</pre><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_how_can_i_debug_the_mapping_request_response_being_sent_by_wiremock" href="#_how_can_i_debug_the_mapping_request_response_being_sent_by_wiremock"></a>3.7.1&nbsp;How can I debug the mapping/request/response being sent by WireMock?</h3></div></div></div><p>Starting from version <code class="literal">1.2.0</code> we turn on WireMock logging to
info and the WireMock notifier to being verbose. Now you will
exactly know what request was received by WireMock server and which
matching response definition was picked.</p><p>To turn off this feature just bump WireMock logging to <code class="literal">ERROR</code></p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.level.com.github.tomakehurst.wiremock</span>=ERROR</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_how_can_i_see_what_got_registered_in_the_http_server_stub" href="#_how_can_i_see_what_got_registered_in_the_http_server_stub"></a>3.7.2&nbsp;How can I see what got registered in the HTTP server stub?</h3></div></div></div><p>You can use the <code class="literal">mappingsOutputFolder</code> property on <code class="literal">@AutoConfigureStubRunner</code> or <code class="literal">StubRunnerRule</code>
to dump all mappings per artifact id. Also the port at which the given stub server was
started will be attached.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_can_i_reference_the_request_from_the_response" href="#_can_i_reference_the_request_from_the_response"></a>3.7.3&nbsp;Can I reference the request from the response?</h3></div></div></div><p>Yes! With version 1.1.0 we&#8217;ve added such a possibility. On the HTTP stub server side we&#8217;re providing support
for this for WireMock. In case of other HTTP server stubs you&#8217;ll have to implement the approach yourself.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_can_i_reference_text_from_file" href="#_can_i_reference_text_from_file"></a>3.7.4&nbsp;Can I reference text from file?</h3></div></div></div><p>Yes! With version 1.2.0 we&#8217;ve added such a possibility. It&#8217;s enough to call <code class="literal">file(&#8230;&#8203;)</code> method in the
started will be attached.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_can_i_reference_text_from_file" href="#_can_i_reference_text_from_file"></a>3.7.3&nbsp;Can I reference text from file?</h3></div></div></div><p>Yes! With version 1.2.0 we&#8217;ve added such a possibility. It&#8217;s enough to call <code class="literal">file(&#8230;&#8203;)</code> method in the
DSL and provide a path relative to where the contract lays.
If you&#8217;re using YAML just use the <code class="literal">bodyFromFile</code> property.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__spring_cloud_contract_verifier_introduction.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__spring_cloud_contract_verifier_setup.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.&nbsp;Spring Cloud Contract Verifier Introduction&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-contract.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;4.&nbsp;Spring Cloud Contract Verifier Setup</td></tr></table></div></body></html>

View File

@@ -9,14 +9,14 @@ produced by Spring Cloud Contract Verifier.</li><li class="listitem">Messaging r
Integration, Spring Cloud Stream, Spring AMQP, and Apache Camel. You can also set your
own integrations.</li><li class="listitem">Acceptance tests (in JUnit or Spock) are used to verify if server-side implementation
of the API is compliant with the contract (<span class="emphasis"><em>server tests</em></span>). A full test is generated by
Spring Cloud Contract Verifier.</li></ul></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_why_a_contract_verifier" href="#_why_a_contract_verifier"></a>2.1&nbsp;Why a Contract Verifier?</h2></div></div></div><p>Assume that we have a system consisting of multiple microservices:</p><div class="informalfigure"><div class="mediaobject"><img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/1.2.x/docs/src/main/asciidoc/images/Deps.png" alt="Microservices Architecture"></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_testing_issues" href="#_testing_issues"></a>2.1.1&nbsp;Testing issues</h3></div></div></div><p>If we wanted to test the application in top left corner to determine whether it can
Spring Cloud Contract Verifier.</li></ul></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_why_a_contract_verifier" href="#_why_a_contract_verifier"></a>2.1&nbsp;Why a Contract Verifier?</h2></div></div></div><p>Assume that we have a system consisting of multiple microservices:</p><div class="informalfigure"><div class="mediaobject"><img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images/Deps.png" alt="Microservices Architecture"></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_testing_issues" href="#_testing_issues"></a>2.1.1&nbsp;Testing issues</h3></div></div></div><p>If we wanted to test the application in top left corner to determine whether it can
communicate with other services, we could do one of two things:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Deploy all microservices and perform end-to-end tests.</li><li class="listitem">Mock other microservices in unit/integration tests.</li></ul></div><p>Both have their advantages but also a lot of disadvantages.</p><p><span class="strong"><strong>Deploy all microservices and perform end to end tests</strong></span></p><p>Advantages:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Simulates production.</li><li class="listitem">Tests real communication between services.</li></ul></div><p>Disadvantages:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">To test one microservice, we have to deploy 6 microservices, a couple of databases,
etc.</li><li class="listitem">The environment where the tests run is locked for a single suite of tests (nobody else
would be able to run the tests in the meantime).</li><li class="listitem">They take a long time to run.</li><li class="listitem">The feedback comes very late in the process.</li><li class="listitem">They are extremely hard to debug.</li></ul></div><p><span class="strong"><strong>Mock other microservices in unit/integration tests</strong></span></p><p>Advantages:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">They provide very fast feedback.</li><li class="listitem">They have no infrastructure requirements.</li></ul></div><p>Disadvantages:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The implementor of the service creates stubs that might have nothing to do with
reality.</li><li class="listitem">You can go to production with passing tests and failing production.</li></ul></div><p>To solve the aforementioned issues, Spring Cloud Contract Verifier with Stub Runner was
created. The main idea is to give you very fast feedback, without the need to set up the
whole world of microservices. If you work on stubs, then the only applications you need
are those that your application directly uses.</p><div class="informalfigure"><div class="mediaobject"><img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/1.2.x/docs/src/main/asciidoc/images/Stubs2.png" alt="Stubbed Services"></div></div><p>Spring Cloud Contract Verifier gives you the certainty that the stubs that you use were
are those that your application directly uses.</p><div class="informalfigure"><div class="mediaobject"><img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images/Stubs2.png" alt="Stubbed Services"></div></div><p>Spring Cloud Contract Verifier gives you the certainty that the stubs that you use were
created by the service that you&#8217;re calling. Also, if you can use them, it means that they
were tested against the producer&#8217;s side. In short, you can trust those stubs.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_purposes" href="#_purposes"></a>2.2&nbsp;Purposes</h2></div></div></div><p>The main purposes of Spring Cloud Contract Verifier with Stub Runner are:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">To ensure that WireMock/Messaging stubs (used when developing the client) do exactly
what the actual server-side implementation does.</li><li class="listitem">To promote ATDD method and Microservices architectural style.</li><li class="listitem">To provide a way to publish changes in contracts that are immediately visible on both
@@ -393,8 +393,8 @@ us. The current implementation of our system grants loans to everybody.</p><p>As
sprint, we must develop a new feature: if a client wants to borrow too much money, then
we mark the client as a fraud.</p><p>Technical remark - Fraud Detection has an <code class="literal">artifact-id</code> of <code class="literal">http-server</code>, while Loan
Issuance has an artifact-id of <code class="literal">http-client</code>, and both have a <code class="literal">group-id</code> of <code class="literal">com.example</code>.</p><p>Social remark - both client and server development teams need to communicate directly and
discuss changes while going through the process. CDC is all about communication.</p><p>The <a class="link" href="https://github.com/spring-cloud/spring-cloud-contract/tree/1.2.x/samples/standalone/dsl/http-server" target="_top">server
side code is available here</a> and <a class="link" href="https://github.com/spring-cloud/spring-cloud-contract/tree/1.2.x/samples/standalone/dsl/http-client" target="_top">the
discuss changes while going through the process. CDC is all about communication.</p><p>The <a class="link" href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples/standalone/dsl/http-server" target="_top">server
side code is available here</a> and <a class="link" href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples/standalone/dsl/http-client" target="_top">the
client code here</a>.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>In this case, the producer owns the contracts. Physically, all the contract are
in the producer&#8217;s repository.</p></td></tr></table></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_technical_note" href="#_technical_note"></a>2.4.1&nbsp;Technical note</h3></div></div></div><p>If using the <span class="strong"><strong>SNAPSHOT</strong></span> / <span class="strong"><strong>Milestone</strong></span> / <span class="strong"><strong>Release Candidate</strong></span> versions please add the
following section to your build:</p><p class="primary"><b>Maven.&nbsp;</b>

View File

@@ -1,7 +1,7 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>4.&nbsp;Spring Cloud Contract Verifier Setup</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="up" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="prev" href="multi__spring_cloud_contract_faq.html" title="3.&nbsp;Spring Cloud Contract FAQ"><link rel="next" href="multi__spring_cloud_contract_verifier_messaging.html" title="5.&nbsp;Spring Cloud Contract Verifier Messaging"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.&nbsp;Spring Cloud Contract Verifier Setup</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__spring_cloud_contract_faq.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__spring_cloud_contract_verifier_messaging.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_spring_cloud_contract_verifier_setup" href="#_spring_cloud_contract_verifier_setup"></a>4.&nbsp;Spring Cloud Contract Verifier Setup</h1></div></div></div><p>You can set up Spring Cloud Contract Verifier in the following ways:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="multi__spring_cloud_contract_verifier_setup.html#gradle-project" title="4.1&nbsp;Gradle Project">As a Gradle project</a></li><li class="listitem"><a class="link" href="multi__spring_cloud_contract_verifier_setup.html#maven-project" title="4.2&nbsp;Maven Project">As a Maven project</a></li><li class="listitem"><a class="link" href="multi__spring_cloud_contract_verifier_setup.html#docker-project" title="4.6&nbsp;Docker Project">As a Docker project</a></li></ul></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="gradle-project" href="#gradle-project"></a>4.1&nbsp;Gradle Project</h2></div></div></div><p>To learn how to set up the Gradle project for Spring Cloud Contract Verifier, read the
following sections:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-prerequisites" title="4.1.1&nbsp;Prerequisites">Section&nbsp;4.1.1, &#8220;Prerequisites&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-add-gradle-plugin" title="4.1.2&nbsp;Add Gradle Plugin with Dependencies">Section&nbsp;4.1.2, &#8220;Add Gradle Plugin with Dependencies&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-and-rest-assured" title="4.1.3&nbsp;Gradle and Rest Assured 2.0">Section&nbsp;4.1.3, &#8220;Gradle and Rest Assured 2.0&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-snapshot-versions" title="4.1.4&nbsp;Snapshot Versions for Gradle">Section&nbsp;4.1.4, &#8220;Snapshot Versions for Gradle&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-add-stubs" title="4.1.5&nbsp;Add stubs">Section&nbsp;4.1.5, &#8220;Add stubs&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-default-setup" title="4.1.7&nbsp;Default Setup">Section&nbsp;4.1.7, &#8220;Default Setup&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-configure-plugin" title="4.1.8&nbsp;Configure Plugin">Section&nbsp;4.1.8, &#8220;Configure Plugin&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-configuration-options" title="4.1.9&nbsp;Configuration Options">Section&nbsp;4.1.9, &#8220;Configuration Options&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-single-base-class" title="4.1.10&nbsp;Single Base Class for All Tests">Section&nbsp;4.1.10, &#8220;Single Base Class for All Tests&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-different-base-classes" title="4.1.11&nbsp;Different Base Classes for Contracts">Section&nbsp;4.1.11, &#8220;Different Base Classes for Contracts&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-invoking-generated-tests" title="4.1.12&nbsp;Invoking Generated Tests">Section&nbsp;4.1.12, &#8220;Invoking Generated Tests&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-consumer" title="4.1.13&nbsp;Spring Cloud Contract Verifier on the Consumer Side">Section&nbsp;4.1.13, &#8220;Spring Cloud Contract Verifier on the Consumer Side&#8221;</a></li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="gradle-prerequisites" href="#gradle-prerequisites"></a>4.1.1&nbsp;Prerequisites</h3></div></div></div><p>In order to use Spring Cloud Contract Verifier with WireMock, you muse use either a
following sections:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-prerequisites" title="4.1.1&nbsp;Prerequisites">Section&nbsp;4.1.1, &#8220;Prerequisites&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-add-gradle-plugin" title="4.1.2&nbsp;Add Gradle Plugin with Dependencies">Section&nbsp;4.1.2, &#8220;Add Gradle Plugin with Dependencies&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-and-rest-assured" title="4.1.3&nbsp;Gradle and Rest Assured 2.0">Section&nbsp;4.1.3, &#8220;Gradle and Rest Assured 2.0&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-snapshot-versions" title="4.1.4&nbsp;Snapshot Versions for Gradle">Section&nbsp;4.1.4, &#8220;Snapshot Versions for Gradle&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-add-stubs" title="4.1.5&nbsp;Add stubs">Section&nbsp;4.1.5, &#8220;Add stubs&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-default-setup" title="4.1.7&nbsp;Default Setup">Section&nbsp;4.1.7, &#8220;Default Setup&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-configure-plugin" title="4.1.8&nbsp;Configure Plugin">Section&nbsp;4.1.8, &#8220;Configure Plugin&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-configuration-options" title="4.1.9&nbsp;Configuration Options">Section&nbsp;4.1.9, &#8220;Configuration Options&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-single-base-class" title="4.1.10&nbsp;Single Base Class for All Tests">Section&nbsp;4.1.10, &#8220;Single Base Class for All Tests&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-different-base-classes" title="4.1.11&nbsp;Different Base Classes for Contracts">Section&nbsp;4.1.11, &#8220;Different Base Classes for Contracts&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-invoking-generated-tests" title="4.1.12&nbsp;Invoking Generated Tests">Section&nbsp;4.1.12, &#8220;Invoking Generated Tests&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-pushing-stubs-to-scm" title="4.1.13&nbsp;Pushing stubs to SCM">Section&nbsp;4.1.13, &#8220;Pushing stubs to SCM&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#gradle-consumer" title="4.1.14&nbsp;Spring Cloud Contract Verifier on the Consumer Side">Section&nbsp;4.1.14, &#8220;Spring Cloud Contract Verifier on the Consumer Side&#8221;</a></li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="gradle-prerequisites" href="#gradle-prerequisites"></a>4.1.1&nbsp;Prerequisites</h3></div></div></div><p>In order to use Spring Cloud Contract Verifier with WireMock, you muse use either a
Gradle or a Maven plugin.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td><th align="left">Warning</th></tr><tr><td align="left" valign="top"><p>If you want to use Spock in your projects, you must add separately the
<code class="literal">spock-core</code> and <code class="literal">spock-spring</code> modules. Check <a class="link" href="http://spockframework.github.io/" target="_top">Spock
docs for more information</a></p></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="gradle-add-gradle-plugin" href="#gradle-add-gradle-plugin"></a>4.1.2&nbsp;Add Gradle Plugin with Dependencies</h3></div></div></div><p>To add a Gradle plugin with dependencies, use code similar to this:</p><pre class="programlisting">buildscript {
@@ -133,7 +133,8 @@ GroovyDSL. By default, its value is <code class="literal">$rootDir/src/test/reso
from the Groovy DSL should be placed. By default its value is
<code class="literal">$buildDir/generated-test-sources/contractVerifier</code>.</li><li class="listitem"><span class="strong"><strong>stubsOutputDir</strong></span>: Specifies the directory where the generated WireMock stubs from
the Groovy DSL should be placed.</li><li class="listitem"><span class="strong"><strong>targetFramework</strong></span>: Specifies the target test framework to be used. Currently, Spock and
JUnit are supported with JUnit being the default framework.</li></ul></div><p>The following properties are used when you want to specify the location of the JAR
JUnit are supported with JUnit being the default framework.</li><li class="listitem"><span class="strong"><strong>contractsProperties</strong></span>: a map containing properties to be passed to Spring Cloud Contract
components. Those properties might be used by e.g. inbuilt or custom Stub Downloaders.</li></ul></div><p>The following properties are used when you want to specify the location of the JAR
containing the contracts:
* <span class="strong"><strong>contractDependency</strong></span>: Specifies the Dependency that provides
<code class="literal">groupid:artifactid:version:classifier</code> coordinates. You can use the <code class="literal">contractDependency</code>
@@ -184,7 +185,14 @@ baseClassMappings {
- <code class="literal">src/test/resources/contract/foo/</code></p><p>By providing the <code class="literal">baseClassForTests</code>, we have a fallback in case mapping did not succeed.
(You could also provide the <code class="literal">packageWithBaseClasses</code> as a fallback.) That way, the tests
generated from <code class="literal">src/test/resources/contract/com/</code> contracts extend the
<code class="literal">com.example.ComBase</code>, whereas the rest of the tests extend <code class="literal">com.example.FooBase</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="gradle-invoking-generated-tests" href="#gradle-invoking-generated-tests"></a>4.1.12&nbsp;Invoking Generated Tests</h3></div></div></div><p>To ensure that the provider side is compliant with defined contracts, you need to invoke:</p><pre class="programlisting">./gradlew generateContractTests <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">test</span></pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="gradle-consumer" href="#gradle-consumer"></a>4.1.13&nbsp;Spring Cloud Contract Verifier on the Consumer Side</h3></div></div></div><p>In a consuming service, you need to configure the Spring Cloud Contract Verifier plugin
<code class="literal">com.example.ComBase</code>, whereas the rest of the tests extend <code class="literal">com.example.FooBase</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="gradle-invoking-generated-tests" href="#gradle-invoking-generated-tests"></a>4.1.12&nbsp;Invoking Generated Tests</h3></div></div></div><p>To ensure that the provider side is compliant with defined contracts, you need to invoke:</p><pre class="programlisting">./gradlew generateContractTests <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">test</span></pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="gradle-pushing-stubs-to-scm" href="#gradle-pushing-stubs-to-scm"></a>4.1.13&nbsp;Pushing stubs to SCM</h3></div></div></div><p>If you&#8217;re using the SCM repository to keep the contracts and
stubs, you might want to automate the step of pushing stubs to
the repository. To do that, it&#8217;s enough to call the <code class="literal">pushStubsToScm</code>
task. Example:</p><pre class="programlisting">$ ./gradlew pushStubsToScm</pre><p>Under <a class="xref" href="multi__using_the_pluggable_architecture.html#scm-stub-downloader" title="10.6&nbsp;Using the SCM Stub Downloader">Section&nbsp;10.6, &#8220;Using the SCM Stub Downloader&#8221;</a> you can find all possible
configuration options that you can pass either via
the <code class="literal">contractsProperties</code> field e.g. <code class="literal">contracts { contractsProperties = [foo:"bar"] }</code>,
via <code class="literal">contractsProperties</code> method e.g. <code class="literal">contracts { contractsProperties([foo:"bar"]) }</code>,
a system property or an environment variable.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="gradle-consumer" href="#gradle-consumer"></a>4.1.14&nbsp;Spring Cloud Contract Verifier on the Consumer Side</h3></div></div></div><p>In a consuming service, you need to configure the Spring Cloud Contract Verifier plugin
in exactly the same way as in case of provider. If you do not want to use Stub Runner
then you need to copy contracts stored in <code class="literal">src/test/resources/contracts</code> and generate
WireMock JSON stubs using:</p><pre class="programlisting">./gradlew generateClientStubs</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">stubsOutputDir</code> option has to be set for stub generation to work.</p></td></tr></table></div><p>When present, JSON stubs can be used in automated tests of consuming a service.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@ContextConfiguration(loader == SpringApplicationContextLoader, classes == Application)</span></em>
@@ -209,7 +217,7 @@ WireMock JSON stubs using:</p><pre class="programlisting">./gradlew generateClie
}
}</pre><p><code class="literal">LoanApplication</code> makes a call to <code class="literal">FraudDetection</code> service. This request is handled by a
WireMock server configured with stubs generated by Spring Cloud Contract Verifier.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="maven-project" href="#maven-project"></a>4.2&nbsp;Maven Project</h2></div></div></div><p>To learn how to set up the Maven project for Spring Cloud Contract Verifier, read the
following sections:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-add-plugin" title="4.2.1&nbsp;Add maven plugin">Section&nbsp;4.2.1, &#8220;Add maven plugin&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-rest-assured" title="4.2.2&nbsp;Maven and Rest Assured 2.0">Section&nbsp;4.2.2, &#8220;Maven and Rest Assured 2.0&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-snapshot-versions" title="4.2.3&nbsp;Snapshot versions for Maven">Section&nbsp;4.2.3, &#8220;Snapshot versions for Maven&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-add-stubs" title="4.2.4&nbsp;Add stubs">Section&nbsp;4.2.4, &#8220;Add stubs&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-run-plugin" title="4.2.5&nbsp;Run plugin">Section&nbsp;4.2.5, &#8220;Run plugin&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-configure-plugin" title="4.2.6&nbsp;Configure plugin">Section&nbsp;4.2.6, &#8220;Configure plugin&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-configuration-options" title="4.2.7&nbsp;Configuration Options">Section&nbsp;4.2.7, &#8220;Configuration Options&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-single-base" title="4.2.8&nbsp;Single Base Class for All Tests">Section&nbsp;4.2.8, &#8220;Single Base Class for All Tests&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-different-base" title="4.2.9&nbsp;Different base classes for contracts">Section&nbsp;4.2.9, &#8220;Different base classes for contracts&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-invoking-generated-tests" title="4.2.10&nbsp;Invoking generated tests">Section&nbsp;4.2.10, &#8220;Invoking generated tests&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-sts" title="4.2.11&nbsp;Maven Plugin and STS">Section&nbsp;4.2.11, &#8220;Maven Plugin and STS&#8221;</a></li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="maven-add-plugin" href="#maven-add-plugin"></a>4.2.1&nbsp;Add maven plugin</h3></div></div></div><p>Add the Spring Cloud Contract BOM in a fashion similar to this:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;dependencyManagement&gt;</span>
following sections:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-add-plugin" title="4.2.1&nbsp;Add maven plugin">Section&nbsp;4.2.1, &#8220;Add maven plugin&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-rest-assured" title="4.2.2&nbsp;Maven and Rest Assured 2.0">Section&nbsp;4.2.2, &#8220;Maven and Rest Assured 2.0&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-snapshot-versions" title="4.2.3&nbsp;Snapshot versions for Maven">Section&nbsp;4.2.3, &#8220;Snapshot versions for Maven&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-add-stubs" title="4.2.4&nbsp;Add stubs">Section&nbsp;4.2.4, &#8220;Add stubs&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-run-plugin" title="4.2.5&nbsp;Run plugin">Section&nbsp;4.2.5, &#8220;Run plugin&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-configure-plugin" title="4.2.6&nbsp;Configure plugin">Section&nbsp;4.2.6, &#8220;Configure plugin&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-configuration-options" title="4.2.7&nbsp;Configuration Options">Section&nbsp;4.2.7, &#8220;Configuration Options&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-single-base" title="4.2.8&nbsp;Single Base Class for All Tests">Section&nbsp;4.2.8, &#8220;Single Base Class for All Tests&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-different-base" title="4.2.9&nbsp;Different base classes for contracts">Section&nbsp;4.2.9, &#8220;Different base classes for contracts&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-invoking-generated-tests" title="4.2.10&nbsp;Invoking generated tests">Section&nbsp;4.2.10, &#8220;Invoking generated tests&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-pushing-stubs-to-scm" title="4.2.11&nbsp;Pushing stubs to SCM">Section&nbsp;4.2.11, &#8220;Pushing stubs to SCM&#8221;</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_contract_verifier_setup.html#maven-sts" title="4.2.12&nbsp;Maven Plugin and STS">Section&nbsp;4.2.12, &#8220;Maven Plugin and STS&#8221;</a></li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="maven-add-plugin" href="#maven-add-plugin"></a>4.2.1&nbsp;Add maven plugin</h3></div></div></div><p>Add the Spring Cloud Contract BOM in a fashion similar to this:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;dependencyManagement&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;dependencies&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;dependency&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;groupId&gt;</span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/groupId&gt;</span>
@@ -375,7 +383,8 @@ the matched contract. For example, if you have a contract under
<code class="literal">src/test/resources/contract/foo/bar/baz/</code> and map the property
<code class="literal">.* &#8594; com.example.base.BaseClass</code>, then the test class generated from these contracts
extends <code class="literal">com.example.base.BaseClass</code>. This setting takes precedence over
<span class="strong"><strong>packageWithBaseClasses</strong></span> and <span class="strong"><strong>baseClassForTests</strong></span>.</li></ul></div><p>If you want to download your contract definitions from a Maven repository, you can use
<span class="strong"><strong>packageWithBaseClasses</strong></span> and <span class="strong"><strong>baseClassForTests</strong></span>.</li><li class="listitem"><span class="strong"><strong>contractsProperties</strong></span>: a map containing properties to be passed to Spring Cloud Contract
components. Those properties might be used by e.g. inbuilt or custom Stub Downloaders.</li></ul></div><p>If you want to download your contract definitions from a Maven repository, you can use
the following options:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>contractDependency</strong></span>: The contract dependency that contains all the packaged contracts.</li><li class="listitem"><span class="strong"><strong>contractsPath</strong></span>: The path to the concrete contracts in the JAR with packaged contracts.
Defaults to <code class="literal">groupid/artifactid</code> where <code class="literal">gropuid</code> is slash separated.</li><li class="listitem"><span class="strong"><strong>contractsMode</strong></span>: Picks the mode in which stubs will be found and registered</li><li class="listitem"><span class="strong"><strong>contractsSnapshotCheckSkip</strong></span>: If <code class="literal">true</code> then will not assert whether a stub / contract
JAR was downloaded from local or remote location</li><li class="listitem"><span class="strong"><strong>deleteStubsAfterTest</strong></span>: If set to <code class="literal">false</code> will not remove any downloaded
@@ -497,7 +506,46 @@ goal.</p><p>For Groovy Spock code, use the following:</p><pre class="programlist
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/testSources&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/configuration&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/plugin&gt;</span></pre><p>To ensure that provider side is compliant with defined contracts, you need to invoke
<code class="literal">mvn generateTest test</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="maven-sts" href="#maven-sts"></a>4.2.11&nbsp;Maven Plugin and STS</h3></div></div></div><p>If you see the following exception while using STS:</p><div class="informalfigure"><div class="mediaobject"><img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/1.2.x/docs/src/main/asciidoc/images/sts_exception.png" alt="STS Exception"></div></div><p>When you click on the error marker you should see something like this:</p><pre class="programlisting"> plugin:<span class="hl-number">1.1</span>.<span class="hl-number">0.</span>M1:convert:default-convert:process-<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">test</span>-resources) org.apache.maven.plugin.PluginExecutionException: Execution default-convert of goal org.springframework.cloud:spring-
<code class="literal">mvn generateTest test</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="maven-pushing-stubs-to-scm" href="#maven-pushing-stubs-to-scm"></a>4.2.11&nbsp;Pushing stubs to SCM</h3></div></div></div><p>If you&#8217;re using the SCM repository to keep the contracts and
stubs, you might want to automate the step of pushing stubs to
the repository. To do that, it&#8217;s enough to add the <code class="literal">pushStubsToScm</code>
goal. Example:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;plugin&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;groupId&gt;</span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/groupId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;artifactId&gt;</span>spring-cloud-contract-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/artifactId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;version&gt;</span>${spring-cloud-contract.version}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;extensions&gt;</span>true<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/extensions&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;configuration&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">&lt;!-- Base class mappings etc. --&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">&lt;!-- We want to pick contracts from a Git repository --&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;contractsRepositoryUrl&gt;</span>git://https://github.com/spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/contractsRepositoryUrl&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">&lt;!-- We reuse the contract dependency section to set up the path
to the folder that contains the contract definitions. In our case the
path will be /groupId/artifactId/version/contracts --&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;contractDependency&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;groupId&gt;</span>${project.groupId}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/groupId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;artifactId&gt;</span>${project.artifactId}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/artifactId&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;version&gt;</span>${project.version}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/version&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/contractDependency&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">&lt;!-- The contracts mode can't be classpath --&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;contractsMode&gt;</span>REMOTE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/contractsMode&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/configuration&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;executions&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;execution&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;phase&gt;</span>package<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/phase&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;goals&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">&lt;!-- By default we will not push the stubs back to SCM,
you have to explicitly add it as a goal --&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;goal&gt;</span>pushStubsToScm<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/goal&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/goals&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/execution&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/executions&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/plugin&gt;</span></pre><p>Under <a class="xref" href="multi__using_the_pluggable_architecture.html#scm-stub-downloader" title="10.6&nbsp;Using the SCM Stub Downloader">Section&nbsp;10.6, &#8220;Using the SCM Stub Downloader&#8221;</a> you can find all possible
configuration options that you can pass either via
the <code class="literal">&lt;configuration&gt;&lt;contractProperties&gt;</code> map, a system property
or an environment variable.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="maven-sts" href="#maven-sts"></a>4.2.12&nbsp;Maven Plugin and STS</h3></div></div></div><p>If you see the following exception while using STS:</p><div class="informalfigure"><div class="mediaobject"><img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images/sts_exception.png" alt="STS Exception"></div></div><p>When you click on the error marker you should see something like this:</p><pre class="programlisting"> plugin:<span class="hl-number">1.1</span>.<span class="hl-number">0.</span>M1:convert:default-convert:process-<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">test</span>-resources) org.apache.maven.plugin.PluginExecutionException: Execution default-convert of goal org.springframework.cloud:spring-
cloud-contract-maven-plugin:<span class="hl-number">1.1</span>.<span class="hl-number">0.</span>M1:convert failed. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:<span class="hl-number">145</span>) at
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:<span class="hl-number">331</span>) at org.eclipse.m2e.core.internal.embedder.MavenImpl$<span class="hl-number">11.</span>call(MavenImpl.java:<span class="hl-number">1362</span>) at
...

View File

@@ -376,4 +376,20 @@ org.springframework.cloud.contract.stubrunner.StubDownloaderBuilder=\
com.example.CustomStubDownloaderBuilder</pre><p>Now you can pick a folder with the source of your stubs.</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png"></td><th align="left">Important</th></tr><tr><td align="left" valign="top"><p>If you do not provide any implementation, then the default is used (scan classpath).
If you provide the <code class="literal">stubsMode = StubRunnerProperties.StubsMode.LOCAL</code> or
<code class="literal">, stubsMode = StubRunnerProperties.StubsMode.REMOTE</code> then the Aether implementation will be used
If you provide more than one, then the first one on the list is used.</p></td></tr></table></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__customization.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__spring_cloud_contract_wiremock.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9.&nbsp;Customization&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-contract.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;11.&nbsp;Spring Cloud Contract WireMock</td></tr></table></div></body></html>
If you provide more than one, then the first one on the list is used.</p></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="scm-stub-downloader" href="#scm-stub-downloader"></a>10.6&nbsp;Using the SCM Stub Downloader</h2></div></div></div><p>Whenever the <code class="literal">repositoryRoot</code> starts with a SCM protocol
(currently we support only <code class="literal">git://</code>), the stub downloader will try
to clone the repository and use it as a source of contracts
to generate tests or stubs.</p><p>Either via environment variables, system properties, properties set
inside the plugin or contracts repository configuration you can
tweak the downloader&#8217;s behaviour. Below you can find the list of
properties</p><div class="table"><a name="d0e7143" href="#d0e7143"></a><p class="title"><b>Table&nbsp;10.1.&nbsp;SCM Stub Downloader properties</b></p><div class="table-contents"><table summary="SCM Stub Downloader properties" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Type of a property</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Name of the property</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Description</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>* <code class="literal">git.branch</code> (plugin prop)
* <code class="literal">stubrunner.properties.git.branch</code> (system prop)
* <code class="literal">STUBRUNNER_PROPERTIES_GIT_BRANCH</code> (env prop)</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>master</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Which branch to checkout</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>* <code class="literal">git.username</code> (plugin prop)
* <code class="literal">stubrunner.properties.git.username</code> (system prop)
* <code class="literal">STUBRUNNER_PROPERTIES_GIT_USERNAME</code> (env prop)</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">&nbsp;</td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Git clone username</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>* <code class="literal">git.password</code> (plugin prop)
* <code class="literal">stubrunner.properties.git.password</code> (system prop)
* <code class="literal">STUBRUNNER_PROPERTIES_GIT_PASSWORD</code> (env prop)</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">&nbsp;</td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Git clone password</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>* <code class="literal">git.no-of-attempts</code> (plugin prop)
* <code class="literal">stubrunner.properties.git.no-of-attempts</code> (system prop)
* <code class="literal">STUBRUNNER_PROPERTIES_GIT_NO_OF_ATTEMPTS</code> (env prop)</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>10</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Number of attempts to push the commits to <code class="literal">origin</code></p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>* <code class="literal">git.wait-between-attempts</code> (Plugin prop)
* <code class="literal">stubrunner.properties.git.wait-between-attempts</code> (system prop)
* <code class="literal">STUBRUNNER_PROPERTIES_GIT_WAIT_BETWEEN_ATTEMPTS</code> (env prop)</p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>1000</p></td><td style="" align="left" valign="top"><p>Number of millis to wait between attempts to push the commits to <code class="literal">origin</code></p></td></tr></tbody></table></div></div><br class="table-break"></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__customization.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__spring_cloud_contract_wiremock.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9.&nbsp;Customization&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-contract.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;11.&nbsp;Spring Cloud Contract WireMock</td></tr></table></div></body></html>

View File

@@ -1,4 +1,4 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="up" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="prev" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="next" href="multi__spring_cloud_contract.html" title="1.&nbsp;Spring Cloud Contract"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi_spring-cloud-contract.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__spring_cloud_contract.html">Next</a></td></tr></table><hr></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a name="d0e9" href="#d0e9"></a></h1></div></div></div><p>_Documentation Authors: Adam Dudczak, Mathias D&uuml;sterh&ouml;ft, Marcin Grzejszczak, Dennis Kieselhorst, Jakub Kubry&#324;ski, Karol Lassak,
Olga Maciaszek-Sharma, Mariusz Smyku&#322;a, Dave Syer, Jay Bryant</p><p>2.0.0.BUILD-SNAPSHOT</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_spring-cloud-contract.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__spring_cloud_contract.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Spring Cloud Contract&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-contract.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;1.&nbsp;Spring Cloud Contract</td></tr></table></div></body></html>
<title></title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="up" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="prev" href="multi_spring-cloud-contract.html" title="Spring Cloud Contract"><link rel="next" href="multi__spring_cloud_contract.html" title="1.&nbsp;Spring Cloud Contract"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi_spring-cloud-contract.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__spring_cloud_contract.html">Next</a></td></tr></table><hr></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a name="d0e9" href="#d0e9"></a></h1></div></div></div><p><span class="emphasis"><em>Documentation Authors: Adam Dudczak, Mathias D&uuml;sterh&ouml;ft, Marcin Grzejszczak, Dennis Kieselhorst, Jakub Kubry&#324;ski, Karol Lassak,
Olga Maciaszek-Sharma, Mariusz Smyku&#322;a, Dave Syer, Jay Bryant</em></span></p><p>2.0.0.BUILD-SNAPSHOT</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_spring-cloud-contract.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__spring_cloud_contract.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Spring Cloud Contract&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-contract.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;1.&nbsp;Spring Cloud Contract</td></tr></table></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -282,7 +282,7 @@
<th><img src="images/icon_warning_sml.gif" alt="" />&#160;Warnings</th>
<th><img src="images/icon_error_sml.gif" alt="" />&#160;Errors</th></tr>
<tr class="b">
<td>11</td>
<td>12</td>
<td>0</td>
<td>0</td>
<td>0</td></tr></table></div>

View File

@@ -25,7 +25,7 @@ under the License.
<language>en-us</language>
<copyright>&#169;2016 - 2018 Spring</copyright>
<item>
<title>File: 11,
<title>File: 12,
Errors: 0,
Warnings: 0,
Infos: 0
@@ -99,6 +99,20 @@ under the License.
<td>
0
</td>
</tr>
<tr>
<td>
<a href="https://github.com/spring-cloud/spring-cloud-contract/checkstyle.html#org.springframework.cloud.contract.maven.verifier.PushStubsToScmMojo.java">org/springframework/cloud/contract/maven/verifier/PushStubsToScmMojo.java</a>
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
<tr>
<td>
@@ -116,7 +130,7 @@ under the License.
</tr>
<tr>
<td>
<a href="https://github.com/spring-cloud/spring-cloud-contract/checkstyle.html#org.springframework.cloud.contract.maven.verifier.RunMojo.java">org/springframework/cloud/contract/maven/verifier/RunMojo.java</a>
<a href="https://github.com/spring-cloud/spring-cloud-contract/checkstyle.html#org.springframework.cloud.contract.maven.verifier.stubrunner.RemoteStubRunner.java">org/springframework/cloud/contract/maven/verifier/stubrunner/RemoteStubRunner.java</a>
</td>
<td>
0
@@ -144,7 +158,7 @@ under the License.
</tr>
<tr>
<td>
<a href="https://github.com/spring-cloud/spring-cloud-contract/checkstyle.html#org.springframework.cloud.contract.maven.verifier.stubrunner.RemoteStubRunner.java">org/springframework/cloud/contract/maven/verifier/stubrunner/RemoteStubRunner.java</a>
<a href="https://github.com/spring-cloud/spring-cloud-contract/checkstyle.html#org.springframework.cloud.contract.maven.verifier.RunMojo.java">org/springframework/cloud/contract/maven/verifier/RunMojo.java</a>
</td>
<td>
0

View File

@@ -349,6 +349,18 @@ path will be <tt>/com/example/artifactid</tt><br /><b>User property is</b>: <tt>
<tr class="b">
<td><b><a href="#contractsProperties">contractsProperties</a></b></td>
<td><tt>Map</tt></td>
<td><tt>-</tt></td>
<td>Map of properties that can be passed to custom
<tt>StubDownloaderBuilder</tt><br /><b>User property is</b>: <tt>contractsProperties</tt>.<br /></td>
</tr>
<tr class="a">
<td><b><a href="#contractsRepositoryPassword">contractsRepositoryPassword</a></b></td>
<td><tt>String</tt></td>
@@ -358,7 +370,7 @@ path will be <tt>/com/example/artifactid</tt><br /><b>User property is</b>: <tt>
<td>The password to be used to connect to the repo with contracts.<br /><b>User property is</b>: <tt>contractsRepositoryPassword</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#contractsRepositoryProxyHost">contractsRepositoryProxyHost</a></b></td>
@@ -369,7 +381,7 @@ path will be <tt>/com/example/artifactid</tt><br /><b>User property is</b>: <tt>
<td>The proxy host to be used to connect to the repo with contracts.<br /><b>User property is</b>: <tt>contractsRepositoryProxyHost</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#contractsRepositoryProxyPort">contractsRepositoryProxyPort</a></b></td>
@@ -380,7 +392,7 @@ path will be <tt>/com/example/artifactid</tt><br /><b>User property is</b>: <tt>
<td>The proxy port to be used to connect to the repo with contracts.<br /><b>User property is</b>: <tt>contractsRepositoryProxyPort</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#contractsRepositoryUrl">contractsRepositoryUrl</a></b></td>
@@ -394,7 +406,7 @@ was provided then the current Maven's build repositories will be
taken into consideration<br /><b>User property is</b>: <tt>contractsRepositoryUrl</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#contractsRepositoryUsername">contractsRepositoryUsername</a></b></td>
@@ -405,7 +417,7 @@ taken into consideration<br /><b>User property is</b>: <tt>contractsRepositoryUr
<td>The user name to be used to connect to the repo with contracts.<br /><b>User property is</b>: <tt>contractsRepositoryUsername</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#contractsSnapshotCheckSkip">contractsSnapshotCheckSkip</a></b></td>
@@ -417,7 +429,7 @@ taken into consideration<br /><b>User property is</b>: <tt>contractsRepositoryUr
JAR was downloaded from local or remote location<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>contractsSnapshotCheckSkip</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#deleteStubsAfterTest">deleteStubsAfterTest</a></b></td>
@@ -429,7 +441,7 @@ JAR was downloaded from local or remote location<br /><b>Default value is</b>: <
folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>User property is</b>: <tt>deleteStubsAfterTest</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#destination">destination</a></b></td>
@@ -440,7 +452,7 @@ folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>
<td>(no description)<br /><b>Default value is</b>: <tt>${basedir}</tt>.<br /><b>User property is</b>: <tt>stubsDirectory</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#excludeBuildFolders">excludeBuildFolders</a></b></td>
@@ -453,7 +465,7 @@ folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>
further processing.<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>excludeBuildFolders</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#skip">skip</a></b></td>
@@ -464,7 +476,7 @@ further processing.<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User p
<td>(no description)<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>spring.cloud.contract.verifier.skip</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#source">source</a></b></td>
@@ -478,7 +490,7 @@ further processing.<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User p
maven project.</p><br /><b>Default value is</b>: <tt>${basedir}</tt>.<br /><b>User property is</b>: <tt>contractsDirectory</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#stubsDirectory">stubsDirectory</a></b></td>
@@ -555,6 +567,19 @@ path will be <tt>/com/example/artifactid</tt></div>
<li><b>User Property</b>: <tt>contractsPath</tt></li>
</ul><hr />
<p><b><a name="contractsProperties">contractsProperties</a>:</b></p>
<div>Map of properties that can be passed to custom
<tt>StubDownloaderBuilder</tt></div>
<ul>
<li><b>Type</b>: <tt>java.util.Map</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>contractsProperties</tt></li>
</ul><hr />
<p><b><a name="contractsRepositoryPassword">contractsRepositoryPassword</a>:</b></p>
<div>The password to be used to connect to the repo with contracts.</div>

View File

@@ -297,17 +297,6 @@ to be executed first</div>
<tr class="b">
<td><b><a href="#attachContracts">attachContracts</a></b></td>
<td><tt>boolean</tt></td>
<td><tt>-</tt></td>
<td>(no description)<br /><b>Default value is</b>: <tt>true</tt>.<br /></td>
</tr>
<tr class="a">
<td><b><a href="#classifier">classifier</a></b></td>
<td><tt>String</tt></td>
@@ -317,7 +306,7 @@ to be executed first</div>
<td>(no description)<br /><b>Default value is</b>: <tt>stubs</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#excludedFiles">excludedFiles</a></b></td>
@@ -328,7 +317,7 @@ to be executed first</div>
<td>Patterns that should not be taken into account for processing<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#jarSkip">jarSkip</a></b></td>
@@ -339,7 +328,7 @@ to be executed first</div>
<td>Set this to &quot;true&quot; to bypass only JAR creation<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>spring.cloud.contract.verifier.jar.skip</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#outputDirectory">outputDirectory</a></b></td>
@@ -350,7 +339,7 @@ to be executed first</div>
<td>(no description)<br /><b>Default value is</b>: <tt>${project.build.directory}/stubs</tt>.<br /><b>User property is</b>: <tt>stubsDirectory</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#skip">skip</a></b></td>
@@ -366,18 +355,6 @@ to be executed first</div>
<div class="section">
<h3><a name="Parameter_Details"></a>Parameter Details</h3>
<p><b><a name="attachContracts">attachContracts</a>:</b></p>
<div>(no description)</div>
<ul>
<li><b>Type</b>: <tt>boolean</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>Default</b>: <tt>true</tt></li>
</ul><hr />
<p><b><a name="classifier">classifier</a>:</b></p>
<div>(no description)</div>

View File

@@ -405,6 +405,18 @@ path will be <tt>/com/example/artifactid</tt><br /><b>User property is</b>: <tt>
<tr class="b">
<td><b><a href="#contractsProperties">contractsProperties</a></b></td>
<td><tt>Map</tt></td>
<td><tt>-</tt></td>
<td>Map of properties that can be passed to custom
<tt>StubDownloaderBuilder</tt><br /><b>User property is</b>: <tt>contractsProperties</tt>.<br /></td>
</tr>
<tr class="a">
<td><b><a href="#contractsRepositoryPassword">contractsRepositoryPassword</a></b></td>
<td><tt>String</tt></td>
@@ -414,7 +426,7 @@ path will be <tt>/com/example/artifactid</tt><br /><b>User property is</b>: <tt>
<td>The password to be used to connect to the repo with contracts.<br /><b>User property is</b>: <tt>contractsRepositoryPassword</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#contractsRepositoryProxyHost">contractsRepositoryProxyHost</a></b></td>
@@ -425,7 +437,7 @@ path will be <tt>/com/example/artifactid</tt><br /><b>User property is</b>: <tt>
<td>The proxy host to be used to connect to the repo with contracts.<br /><b>User property is</b>: <tt>contractsRepositoryProxyHost</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#contractsRepositoryProxyPort">contractsRepositoryProxyPort</a></b></td>
@@ -436,7 +448,7 @@ path will be <tt>/com/example/artifactid</tt><br /><b>User property is</b>: <tt>
<td>The proxy port to be used to connect to the repo with contracts.<br /><b>User property is</b>: <tt>contractsRepositoryProxyPort</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#contractsRepositoryUrl">contractsRepositoryUrl</a></b></td>
@@ -444,13 +456,13 @@ path will be <tt>/com/example/artifactid</tt><br /><b>User property is</b>: <tt>
<td><tt>-</tt></td>
<td>The URL from which a JAR containing the contracts should get
downloaded. If not provided but artifactid / coordinates notation
was provided then the current Maven's build repositories will be
taken into consideration<br /><b>User property is</b>: <tt>contractsRepositoryUrl</tt>.<br /></td>
<td>The URL from which a contracts should get downloaded. If not
provided but artifactid / coordinates notation was provided then
the current Maven's build repositories will be taken into
consideration<br /><b>User property is</b>: <tt>contractsRepositoryUrl</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#contractsRepositoryUsername">contractsRepositoryUsername</a></b></td>
@@ -461,7 +473,7 @@ taken into consideration<br /><b>User property is</b>: <tt>contractsRepositoryUr
<td>The user name to be used to connect to the repo with contracts.<br /><b>User property is</b>: <tt>contractsRepositoryUsername</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#contractsSnapshotCheckSkip">contractsSnapshotCheckSkip</a></b></td>
@@ -473,7 +485,7 @@ taken into consideration<br /><b>User property is</b>: <tt>contractsRepositoryUr
JAR was downloaded from local or remote location<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>contractsSnapshotCheckSkip</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#deleteStubsAfterTest">deleteStubsAfterTest</a></b></td>
@@ -485,7 +497,7 @@ JAR was downloaded from local or remote location<br /><b>Default value is</b>: <
folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>User property is</b>: <tt>deleteStubsAfterTest</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#excludedFiles">excludedFiles</a></b></td>
@@ -496,7 +508,7 @@ folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>
<td>Patterns that should not be taken into account for processing<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#generatedTestSourcesDir">generatedTestSourcesDir</a></b></td>
@@ -507,7 +519,7 @@ folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>
<td>(no description)<br /><b>Default value is</b>: <tt>${project.build.directory}/generated-test-sources/contracts</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#ignoredFiles">ignoredFiles</a></b></td>
@@ -519,7 +531,7 @@ folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>
@Ignored tests<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#imports">imports</a></b></td>
@@ -530,7 +542,7 @@ folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>
<td>Imports that should be added to generated tests<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#mavenTestSkip">mavenTestSkip</a></b></td>
@@ -541,7 +553,7 @@ folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>
<td>(no description)<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>maven.test.skip</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#nameSuffixForTests">nameSuffixForTests</a></b></td>
@@ -552,7 +564,7 @@ folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>
<td>(no description)<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#packageWithBaseClasses">packageWithBaseClasses</a></b></td>
@@ -571,7 +583,7 @@ test source file that will have the package
last folders to and attach <tt>Base</tt> to its name.<br /><b>User property is</b>: <tt>packageWithBaseClasses</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#ruleClassForTests">ruleClassForTests</a></b></td>
@@ -582,7 +594,7 @@ last folders to and attach <tt>Base</tt> to its name.<br /><b>User property is</
<td>(no description)<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#skip">skip</a></b></td>
@@ -593,7 +605,7 @@ last folders to and attach <tt>Base</tt> to its name.<br /><b>User property is</
<td>(no description)<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>spring.cloud.contract.verifier.skip</tt>.<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#skipTests">skipTests</a></b></td>
@@ -604,7 +616,7 @@ last folders to and attach <tt>Base</tt> to its name.<br /><b>User property is</
<td>(no description)<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>skipTests</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#staticImports">staticImports</a></b></td>
@@ -615,7 +627,7 @@ last folders to and attach <tt>Base</tt> to its name.<br /><b>User property is</
<td>Static imports that should be added to generated tests<br /></td>
</tr>
<tr class="b">
<tr class="a">
<td><b><a href="#testFramework">testFramework</a></b></td>
@@ -626,7 +638,7 @@ last folders to and attach <tt>Base</tt> to its name.<br /><b>User property is</
<td>(no description)<br /><b>Default value is</b>: <tt>JUNIT</tt>.<br /></td>
</tr>
<tr class="a">
<tr class="b">
<td><b><a href="#testMode">testMode</a></b></td>
@@ -758,6 +770,19 @@ path will be <tt>/com/example/artifactid</tt></div>
<li><b>User Property</b>: <tt>contractsPath</tt></li>
</ul><hr />
<p><b><a name="contractsProperties">contractsProperties</a>:</b></p>
<div>Map of properties that can be passed to custom
<tt>StubDownloaderBuilder</tt></div>
<ul>
<li><b>Type</b>: <tt>java.util.Map</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>contractsProperties</tt></li>
</ul><hr />
<p><b><a name="contractsRepositoryPassword">contractsRepositoryPassword</a>:</b></p>
<div>The password to be used to connect to the repo with contracts.</div>
@@ -796,10 +821,10 @@ path will be <tt>/com/example/artifactid</tt></div>
</ul><hr />
<p><b><a name="contractsRepositoryUrl">contractsRepositoryUrl</a>:</b></p>
<div>The URL from which a JAR containing the contracts should get
downloaded. If not provided but artifactid / coordinates notation
was provided then the current Maven's build repositories will be
taken into consideration</div>
<div>The URL from which a contracts should get downloaded. If not
provided but artifactid / coordinates notation was provided then
the current Maven's build repositories will be taken into
consideration</div>
<ul>

View File

@@ -296,6 +296,10 @@ spring-cloud-contract-maven-plugin.<br />
Call <code>mvn spring-cloud-contract:help -Ddetail=true
-Dgoal=&lt;goal-name&gt;</code> to display parameter details.</td></tr>
<tr class="b">
<td><a href="pushStubsToScm-mojo.html">spring-cloud-contract:pushStubsToScm</a></td>
<td>The generated stubs get committed to the SCM repo and pushed to
origin.</td></tr>
<tr class="a">
<td><a href="run-mojo.html">spring-cloud-contract:run</a></td>
<td>No description.</td></tr></table>
<div class="section">

View File

@@ -0,0 +1,551 @@
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2018-03-31
| Rendered using Apache Maven Fluido Skin 1.5
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="Date-Revision-yyyymmdd" content="20180331" />
<meta http-equiv="Content-Language" content="en" />
<title>Spring Cloud Contract Maven Plugin &#x2013; spring-cloud-contract:pushStubsToScm</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.5.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido-1.5.min.js"></script>
</head>
<body class="topBarEnabled">
<a href="https://github.com/spring-cloud/spring-cloud-contract">
<img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"
alt="Fork me on GitHub">
</a>
<div id="topbar" class="navbar navbar-fixed-top ">
<div class="navbar-inner">
<div class="container-fluid">
<a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Overview <b class="caret"></b></a>
<ul class="dropdown-menu">
<li> <a href="index.html" title="Introduction">Introduction</a>
</li>
<li> <a href="usage.html" title="Usage">Usage</a>
</li>
<li> <a href="plugin-info.html" title="Goals">Goals</a>
</li>
<li> <a href="junit.html" title="JUnit Configuration">JUnit Configuration</a>
</li>
<li> <a href="spock.html" title="Spock Configuration">Spock Configuration</a>
</li>
<li> <a href="complex.html" title="Complex Configuration">Complex Configuration</a>
</li>
<li> <a href="configs.html" title="Configuration snippets">Configuration snippets</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Related Projects <b class="caret"></b></a>
<ul class="dropdown-menu">
<li> <a href="https://github.com/spring-cloud/spring-cloud-contract" title="Spring Cloud Contract">Spring Cloud Contract</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Project Documentation <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-submenu">
<a href="project-info.html" title="Project Information">Project Information</a>
<ul class="dropdown-menu">
<li> <a href="integration.html" title="CI Management">CI Management</a>
</li>
<li> <a href="index.html" title="About">About</a>
</li>
<li> <a href="issue-tracking.html" title="Issue Management">Issue Management</a>
</li>
<li> <a href="license.html" title="Licenses">Licenses</a>
</li>
<li> <a href="plugin-management.html" title="Plugin Management">Plugin Management</a>
</li>
<li> <a href="plugins.html" title="Plugins">Plugins</a>
</li>
<li> <a href="team-list.html" title="Team">Team</a>
</li>
<li> <a href="source-repository.html" title="Source Code Management">Source Code Management</a>
</li>
<li> <a href="project-summary.html" title="Summary">Summary</a>
</li>
</ul>
</li>
<li class="dropdown-submenu">
<a href="project-reports.html" title="Project Reports">Project Reports</a>
<ul class="dropdown-menu">
<li> <a href="checkstyle.html" title="Checkstyle">Checkstyle</a>
</li>
<li> <a href="plugin-info.html" title="Plugin Documentation">Plugin Documentation</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div id="banner">
<div class="pull-left">
<div id="bannerLeft">
<h2>Spring Cloud Contract Maven Plugin</h2>
</div>
</div>
<div class="pull-right"> <div id="bannerRight">
<img src="" />
</div>
</div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li id="publishDate">Last Published: 2018-03-31
<span class="divider">|</span>
</li>
<li id="projectVersion">Version: 2.0.0.BUILD-SNAPSHOT
</li>
</ul>
</div>
<div class="row-fluid">
<div id="leftColumn" class="span2">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Overview</li>
<li>
<a href="index.html" title="Introduction">
<span class="none"></span>
Introduction</a>
</li>
<li>
<a href="usage.html" title="Usage">
<span class="none"></span>
Usage</a>
</li>
<li>
<a href="plugin-info.html" title="Goals">
<span class="none"></span>
Goals</a>
</li>
<li>
<a href="junit.html" title="JUnit Configuration">
<span class="none"></span>
JUnit Configuration</a>
</li>
<li>
<a href="spock.html" title="Spock Configuration">
<span class="none"></span>
Spock Configuration</a>
</li>
<li>
<a href="complex.html" title="Complex Configuration">
<span class="none"></span>
Complex Configuration</a>
</li>
<li>
<a href="configs.html" title="Configuration snippets">
<span class="none"></span>
Configuration snippets</a>
</li>
<li class="nav-header">Related Projects</li>
<li>
<a href="https://github.com/spring-cloud/spring-cloud-contract" title="Spring Cloud Contract">
<span class="none"></span>
Spring Cloud Contract</a>
</li>
<li class="nav-header">Project Documentation</li>
<li>
<a href="project-info.html" title="Project Information">
<span class="icon-chevron-right"></span>
Project Information</a>
</li>
<li>
<a href="project-reports.html" title="Project Reports">
<span class="icon-chevron-right"></span>
Project Reports</a>
</li>
</ul>
<hr />
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
</div>
<div id="bodyColumn" class="span10" >
<div class="section">
<h2><a name="spring-cloud-contract:pushStubsToScm"></a>spring-cloud-contract:pushStubsToScm</h2>
<p><b>Full name</b>:</p>
<p>org.springframework.cloud:spring-cloud-contract-maven-plugin:2.0.0.BUILD-SNAPSHOT:pushStubsToScm</p>
<p><b>Description</b>:</p>
<div>The generated stubs get committed to the SCM repo and pushed to
origin.</div>
<p><b>Attributes</b>:</p>
<ul>
<li>Requires a Maven project to be executed.</li>
</ul>
<div class="section">
<h3><a name="Optional_Parameters"></a>Optional Parameters</h3>
<table class="table table-striped" border="0">
<tr class="a">
<th>Name</th>
<th>Type</th>
<th>Since</th>
<th>Description</th>
</tr>
<tr class="b">
<td><b><a href="#contractsMode">contractsMode</a></b></td>
<td><tt>StubRunnerProperties$StubsMode</tt></td>
<td><tt>-</tt></td>
<td>Picks the mode in which stubs will be found and registered<br /><b>Default value is</b>: <tt>CLASSPATH</tt>.<br /><b>User property is</b>: <tt>contractsMode</tt>.<br /></td>
</tr>
<tr class="a">
<td><b><a href="#contractsProperties">contractsProperties</a></b></td>
<td><tt>Map</tt></td>
<td><tt>-</tt></td>
<td>Map of properties that can be passed to custom
<tt>StubDownloaderBuilder</tt><br /><b>User property is</b>: <tt>contractsProperties</tt>.<br /></td>
</tr>
<tr class="b">
<td><b><a href="#contractsRepositoryPassword">contractsRepositoryPassword</a></b></td>
<td><tt>String</tt></td>
<td><tt>-</tt></td>
<td>The password to be used to connect to the repo with contracts.<br /><b>User property is</b>: <tt>contractsRepositoryPassword</tt>.<br /></td>
</tr>
<tr class="a">
<td><b><a href="#contractsRepositoryUrl">contractsRepositoryUrl</a></b></td>
<td><tt>String</tt></td>
<td><tt>-</tt></td>
<td>The URL from which a contracts should get downloaded. If not
provided but artifactid / coordinates notation was provided then
the current Maven's build repositories will be taken into
consideration<br /><b>User property is</b>: <tt>contractsRepositoryUrl</tt>.<br /></td>
</tr>
<tr class="b">
<td><b><a href="#contractsRepositoryUsername">contractsRepositoryUsername</a></b></td>
<td><tt>String</tt></td>
<td><tt>-</tt></td>
<td>The user name to be used to connect to the repo with contracts.<br /><b>User property is</b>: <tt>contractsRepositoryUsername</tt>.<br /></td>
</tr>
<tr class="a">
<td><b><a href="#deleteStubsAfterTest">deleteStubsAfterTest</a></b></td>
<td><tt>boolean</tt></td>
<td><tt>-</tt></td>
<td>If set to <tt>false</tt> will NOT delete stubs from a temporary
folder after running tests<br /><b>Default value is</b>: <tt>true</tt>.<br /><b>User property is</b>: <tt>deleteStubsAfterTest</tt>.<br /></td>
</tr>
<tr class="b">
<td><b><a href="#outputDirectory">outputDirectory</a></b></td>
<td><tt>File</tt></td>
<td><tt>-</tt></td>
<td>(no description)<br /><b>Default value is</b>: <tt>${project.build.directory}/stubs</tt>.<br /><b>User property is</b>: <tt>stubsDirectory</tt>.<br /></td>
</tr>
<tr class="a">
<td><b><a href="#skip">skip</a></b></td>
<td><tt>boolean</tt></td>
<td><tt>-</tt></td>
<td>Set this to &quot;true&quot; to bypass the whole Verifier execution<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>spring.cloud.contract.verifier.skip</tt>.<br /></td>
</tr>
<tr class="b">
<td><b><a href="#taskSkip">taskSkip</a></b></td>
<td><tt>boolean</tt></td>
<td><tt>-</tt></td>
<td>Set this to &quot;true&quot; to bypass only JAR creation<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>spring.cloud.contract.verifier.publish-stubs-to-scm.skip</tt>.<br /></td>
</tr>
</table>
</div>
<div class="section">
<h3><a name="Parameter_Details"></a>Parameter Details</h3>
<p><b><a name="contractsMode">contractsMode</a>:</b></p>
<div>Picks the mode in which stubs will be found and registered</div>
<ul>
<li><b>Type</b>: <tt>org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties$StubsMode</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>contractsMode</tt></li>
<li><b>Default</b>: <tt>CLASSPATH</tt></li>
</ul><hr />
<p><b><a name="contractsProperties">contractsProperties</a>:</b></p>
<div>Map of properties that can be passed to custom
<tt>StubDownloaderBuilder</tt></div>
<ul>
<li><b>Type</b>: <tt>java.util.Map</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>contractsProperties</tt></li>
</ul><hr />
<p><b><a name="contractsRepositoryPassword">contractsRepositoryPassword</a>:</b></p>
<div>The password to be used to connect to the repo with contracts.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>contractsRepositoryPassword</tt></li>
</ul><hr />
<p><b><a name="contractsRepositoryUrl">contractsRepositoryUrl</a>:</b></p>
<div>The URL from which a contracts should get downloaded. If not
provided but artifactid / coordinates notation was provided then
the current Maven's build repositories will be taken into
consideration</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>contractsRepositoryUrl</tt></li>
</ul><hr />
<p><b><a name="contractsRepositoryUsername">contractsRepositoryUsername</a>:</b></p>
<div>The user name to be used to connect to the repo with contracts.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>contractsRepositoryUsername</tt></li>
</ul><hr />
<p><b><a name="deleteStubsAfterTest">deleteStubsAfterTest</a>:</b></p>
<div>If set to <tt>false</tt> will NOT delete stubs from a temporary
folder after running tests</div>
<ul>
<li><b>Type</b>: <tt>boolean</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>deleteStubsAfterTest</tt></li>
<li><b>Default</b>: <tt>true</tt></li>
</ul><hr />
<p><b><a name="outputDirectory">outputDirectory</a>:</b></p>
<div>(no description)</div>
<ul>
<li><b>Type</b>: <tt>java.io.File</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>stubsDirectory</tt></li>
<li><b>Default</b>: <tt>${project.build.directory}/stubs</tt></li>
</ul><hr />
<p><b><a name="skip">skip</a>:</b></p>
<div>Set this to &quot;true&quot; to bypass the whole Verifier execution</div>
<ul>
<li><b>Type</b>: <tt>boolean</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>spring.cloud.contract.verifier.skip</tt></li>
<li><b>Default</b>: <tt>false</tt></li>
</ul><hr />
<p><b><a name="taskSkip">taskSkip</a>:</b></p>
<div>Set this to &quot;true&quot; to bypass only JAR creation</div>
<ul>
<li><b>Type</b>: <tt>boolean</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>spring.cloud.contract.verifier.publish-stubs-to-scm.skip</tt></li>
<li><b>Default</b>: <tt>false</tt></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
<p >Copyright &copy; 2016&#x2013;2018
<a href="https://spring.io/">Spring</a>.
All rights reserved.
</p>
</div>
</div>
</footer>
</body>
</html>

View File

@@ -8,8 +8,8 @@
</info>
<preface>
<title></title>
<simpara>_Documentation Authors: Adam Dudczak, Mathias Düsterhöft, Marcin Grzejszczak, Dennis Kieselhorst, Jakub Kubryński, Karol Lassak,
Olga Maciaszek-Sharma, Mariusz Smykuła, Dave Syer, Jay Bryant</simpara>
<simpara><emphasis>Documentation Authors: Adam Dudczak, Mathias Düsterhöft, Marcin Grzejszczak, Dennis Kieselhorst, Jakub Kubryński, Karol Lassak,
Olga Maciaszek-Sharma, Mariusz Smykuła, Dave Syer, Jay Bryant</emphasis></simpara>
<simpara>2.0.0.BUILD-SNAPSHOT</simpara>
</preface>
<chapter xml:id="_spring_cloud_contract">
@@ -53,7 +53,7 @@ Spring Cloud Contract Verifier.</simpara>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/1.2.x/docs/src/main/asciidoc/images/Deps.png"/>
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images/Deps.png"/>
</imageobject>
<textobject><phrase>Microservices Architecture</phrase></textobject>
</mediaobject>
@@ -128,7 +128,7 @@ are those that your application directly uses.</simpara>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/1.2.x/docs/src/main/asciidoc/images/Stubs2.png"/>
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images/Stubs2.png"/>
</imageobject>
<textobject><phrase>Stubbed Services</phrase></textobject>
</mediaobject>
@@ -710,8 +710,8 @@ we mark the client as a fraud.</simpara>
Issuance has an artifact-id of <literal>http-client</literal>, and both have a <literal>group-id</literal> of <literal>com.example</literal>.</simpara>
<simpara>Social remark - both client and server development teams need to communicate directly and
discuss changes while going through the process. CDC is all about communication.</simpara>
<simpara>The <link xl:href="https://github.com/spring-cloud/spring-cloud-contract/tree/1.2.x/samples/standalone/dsl/http-server">server
side code is available here</link> and <link xl:href="https://github.com/spring-cloud/spring-cloud-contract/tree/1.2.x/samples/standalone/dsl/http-client">the
<simpara>The <link xl:href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples/standalone/dsl/http-server">server
side code is available here</link> and <link xl:href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples/standalone/dsl/http-client">the
client code here</link>.</simpara>
<tip>
<simpara>In this case, the producer owns the contracts. Physically, all the contract are
@@ -1329,7 +1329,7 @@ constant development.</simpara>
<title>Spring Cloud Contract FAQ</title>
<section xml:id="_why_use_spring_cloud_contract_verifier_and_not_x">
<title>Why use Spring Cloud Contract Verifier and not X ?</title>
<simpara>For the time being Spring Cloud Contract Verifier is a JVM based tool. So it could be your first pick when you&#8217;re already creating
<simpara>For the time being Spring Cloud Contract is a JVM based tool. So it could be your first pick when you&#8217;re already creating
software for the JVM. This project has a lot of really interesting features but especially quite a few of them definitely make
Spring Cloud Contract Verifier stand out on the "market" of Consumer Driven Contract (CDC) tooling. Out of many the most interesting are:</simpara>
<itemizedlist>
@@ -1351,6 +1351,12 @@ Spring Cloud Contract Verifier stand out on the "market" of Consumer Driven Cont
<listitem>
<simpara>Spring Cloud integration - no discovery service is needed for integration tests</simpara>
</listitem>
<listitem>
<simpara>Spring Cloud Contract integrates with Pact out of the box and provides easy hooks to extend its functionality</simpara>
</listitem>
<listitem>
<simpara>Via Docker adds support for any language &amp; framework used</simpara>
</listitem>
</itemizedlist>
</section>
<section xml:id="_i_don_t_want_to_write_a_contract_in_groovy">
@@ -1512,7 +1518,7 @@ consumer will you break with your local changes.</simpara>
<title>Repo structure</title>
<simpara>Let&#8217;s assume that we have a producer with coordinates <literal>com.example:server</literal> and 3 consumers: <literal>client1</literal>,
<literal>client2</literal>, <literal>client3</literal>. Then in the repository with common contracts you would have the following setup
(which you can checkout <link xl:href="https://github.com/spring-cloud/spring-cloud-contract/tree/1.0.x/samples/standalone/contracts">here</link>:</simpara>
(which you can checkout <link xl:href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples/standalone/contracts">here</link>):</simpara>
<programlisting language="bash" linenumbering="unnumbered">├── com
│   └── example
│   └── server
@@ -1549,15 +1555,15 @@ one to one to the contents of the repo.</simpara>
&lt;parent&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
&lt;version&gt;1.5.10.RELEASE&lt;/version&gt;
&lt;version&gt;2.0.0.BUILD-SNAPSHOT&lt;/version&gt;
&lt;relativePath /&gt;
&lt;/parent&gt;
&lt;properties&gt;
&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;java.version&gt;1.8&lt;/java.version&gt;
&lt;spring-cloud-contract.version&gt;1.2.5.BUILD-SNAPSHOT&lt;/spring-cloud-contract.version&gt;
&lt;spring-cloud-dependencies.version&gt;Edgware.BUILD-SNAPSHOT&lt;/spring-cloud-dependencies.version&gt;
&lt;spring-cloud-contract.version&gt;2.0.0.BUILD-SNAPSHOT&lt;/spring-cloud-contract.version&gt;
&lt;spring-cloud-dependencies.version&gt;Finchley.BUILD-SNAPSHOT&lt;/spring-cloud-dependencies.version&gt;
&lt;excludeBuildFolders&gt;true&lt;/excludeBuildFolders&gt;
&lt;/properties&gt;
@@ -1735,6 +1741,7 @@ of the JAR containing the contracts:</simpara>
&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
&lt;artifactId&gt;spring-cloud-contract-maven-plugin&lt;/artifactId&gt;
&lt;configuration&gt;
&lt;contractsMode&gt;REMOTE&lt;/contractsMode&gt;
&lt;contractsRepositoryUrl&gt;http://link/to/your/nexus/or/artifactory/or/sth&lt;/contractsRepositoryUrl&gt;
&lt;contractDependency&gt;
&lt;groupId&gt;com.example.standalone&lt;/groupId&gt;
@@ -1909,8 +1916,8 @@ configurations {
include: "**/*",
excludes: [
"**/${project.name}/**"",
**/${first-topic}/**",
**/${second-topic}/**])
"**/${first-topic}/**",
"**/${second-topic}/**"])
}</programlisting>
<itemizedlist>
<listitem>
@@ -1922,20 +1929,214 @@ deleteUnwantedContracts.dependsOn("unzipContracts")
build.dependsOn("deleteUnwantedContracts")</programlisting>
<itemizedlist>
<listitem>
<simpara>Configure plugin by specifying the directory containing contracts using <literal><literal>contractsDslDir</literal></literal> property</simpara>
<simpara>Configure plugin by specifying the directory containing contracts using <literal>contractsDslDir</literal> property</simpara>
</listitem>
</itemizedlist>
<programlisting language="groovy" linenumbering="unnumbered">contracts {
contractsDslDir = new File("${buildDir}/unpackedContracts")
}</programlisting>
</section>
</section>
</section>
<section xml:id="_can_i_have_multiple_base_classes_for_tests">
<title>Can I have multiple base classes for tests?</title>
<simpara>Yes! Check out the <link xl:href="https://cloud.spring.io/spring-cloud-contract/spring-cloud-contract.html#_different_base_classes_for_contracts">Different base classes for contracts</link> sections
of either Gradle or Maven plugins.</simpara>
<section xml:id="_do_i_need_a_binary_storage_can_t_i_use_git">
<title>Do I need a Binary Storage? Can&#8217;t I use Git?</title>
<simpara>In the polyglot world, there are languages that don&#8217;t use binary storages like
Artifactory or Nexus. Starting from Spring Cloud Contract version 2.0.0 we provide
mechanisms to store contracts and stubs in a SCM repository. Currently the
only supported SCM is Git.</simpara>
<simpara>The repository would have to the following setup
(which you can checkout <link xl:href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/2.0.x/contracts_git/">here</link>):</simpara>
<screen>.
└── META-INF
└── com.example
└── beer-api-producer-git
└── 0.0.1-SNAPSHOT
├── contracts
│   └── beer-api-consumer
│   ├── messaging
│   │   ├── shouldSendAcceptedVerification.groovy
│   │   └── shouldSendRejectedVerification.groovy
│   └── rest
│   ├── shouldGrantABeerIfOldEnough.groovy
│   └── shouldRejectABeerIfTooYoung.groovy
└── mappings
└── beer-api-consumer
└── rest
├── shouldGrantABeerIfOldEnough.json
└── shouldRejectABeerIfTooYoung.json</screen>
<simpara>Under <literal>META-INF</literal> folder:</simpara>
<itemizedlist>
<listitem>
<simpara>we group applications via <literal>groupId</literal> (e.g. <literal>com.example</literal>)</simpara>
</listitem>
<listitem>
<simpara>then each application is represented via the <literal>artifactId</literal> (e.g. <literal>beer-api-producer-git</literal>)</simpara>
</listitem>
<listitem>
<simpara>next, the version of the application. The version is mandatory! (e.g. <literal>0.0.1-SNAPSHOT</literal>)</simpara>
</listitem>
<listitem>
<simpara>finally, there are two folders:</simpara>
<itemizedlist>
<listitem>
<simpara><literal>contracts</literal> - the good practice is to store the contracts required by each
consumer in the folder with the consumer name (e.g. <literal>beer-api-consumer</literal>). That way you
can use the <literal>stubs-per-consumer</literal> feature. Further directory structure is arbitrary.</simpara>
</listitem>
<listitem>
<simpara><literal>mappings</literal> - in this folder the Maven / Gradle Spring Cloud Contract plugins will push
the stub server mappings. On the consumer side, Stub Runner will scan this folder
to start stub servers with stub definitions. The folder structure will be a copy
of the one created in the <literal>contracts</literal> subfolder.</simpara>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
<section xml:id="_protocol_convention">
<title>Protocol convention</title>
<simpara>In order to control the type and location of the source of contracts (whether it&#8217;s
a binary storage or an SCM repository), you can use the protocol in the URL of
the repository. Spring Cloud Contract iterates over registered protocol resolvers
and tries to fetch the contracts (via a plugin) or stubs (via Stub Runner).</simpara>
<simpara>For the SCM functionality, currently, we support the Git repository. To use it,
in the property, where the repository URL needs to be placed you just have to prefix
the connection URL with <literal>git://</literal>. Here you can find a couple of examples:</simpara>
<screen>git://file:///foo/bar
git://https://github.com/spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git
git://git@github.com:spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git</screen>
</section>
<section xml:id="_producer_2">
<title>Producer</title>
<simpara>For the producer, to use the SCM approach, we can reuse the
same mechanism we use for external contracts. We route Spring Cloud Contract
to use the SCM implementation via the URL that contains
the <literal>git://</literal> protocol.</simpara>
<important>
<simpara>You have to manually add the <literal>pushStubsToScm</literal>
goal in Maven or execute (bind) the <literal>pushStubsToScm</literal> task in
Gradle. We don&#8217;t push stubs to <literal>origin</literal> of your git
repository out of the box.</simpara>
</important>
<formalpara>
<title>Maven</title>
<para>
<programlisting language="xml" linenumbering="unnumbered">&lt;plugin&gt;
&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
&lt;artifactId&gt;spring-cloud-contract-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;${spring-cloud-contract.version}&lt;/version&gt;
&lt;extensions&gt;true&lt;/extensions&gt;
&lt;configuration&gt;
&lt;!-- Base class mappings etc. --&gt;
&lt;!-- We want to pick contracts from a Git repository --&gt;
&lt;contractsRepositoryUrl&gt;git://https://github.com/spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git&lt;/contractsRepositoryUrl&gt;
&lt;!-- We reuse the contract dependency section to set up the path
to the folder that contains the contract definitions. In our case the
path will be /groupId/artifactId/version/contracts --&gt;
&lt;contractDependency&gt;
&lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
&lt;artifactId&gt;${project.artifactId}&lt;/artifactId&gt;
&lt;version&gt;${project.version}&lt;/version&gt;
&lt;/contractDependency&gt;
&lt;!-- The contracts mode can't be classpath --&gt;
&lt;contractsMode&gt;REMOTE&lt;/contractsMode&gt;
&lt;/configuration&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;phase&gt;package&lt;/phase&gt;
&lt;goals&gt;
&lt;!-- By default we will not push the stubs back to SCM,
you have to explicitly add it as a goal --&gt;
&lt;goal&gt;pushStubsToScm&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;</programlisting>
</para>
</formalpara>
<formalpara>
<title>Gradle</title>
<para>
<programlisting language="gradle" linenumbering="unnumbered">contracts {
// We want to pick contracts from a Git repository
contractDependency {
stringNotation = "${project.group}:${project.name}:${project.version}"
}
/*
We reuse the contract dependency section to set up the path
to the folder that contains the contract definitions. In our case the
path will be /groupId/artifactId/version/contracts
*/
contractRepository {
repositoryUrl = "git://https://github.com/spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git"
}
// The mode can't be classpath
contractsMode = "REMOTE"
// Base class mappings etc.
}
/*
In this scenario we want to publish stubs to SCM whenever
the `publish` task is executed
*/
publish.dependsOn("publishStubsToScm")</programlisting>
</para>
</formalpara>
<simpara>With such a setup:</simpara>
<itemizedlist>
<listitem>
<simpara>Git project will be cloned to a temporary directory</simpara>
</listitem>
<listitem>
<simpara>The SCM stub downloader will go to <literal>META-INF/groupId/artifactId/version/contracts</literal> folder
to find contracts. E.g. for <literal>com.example:foo:1.0.0</literal> the path would be
<literal>META-INF/com.example/foo/1.0.0/contracts</literal></simpara>
</listitem>
<listitem>
<simpara>Tests will be generated from the contracts</simpara>
</listitem>
<listitem>
<simpara>Stubs will be created from the contracts</simpara>
</listitem>
<listitem>
<simpara>Once the tests pass, the stubs will be committed in the cloned repository</simpara>
</listitem>
<listitem>
<simpara>Finally, a push will be done to that repo&#8217;s <literal>origin</literal></simpara>
</listitem>
</itemizedlist>
</section>
<section xml:id="_consumer_2">
<title>Consumer</title>
<simpara>On the consumer side when passing the <literal>repositoryRoot</literal> parameter,
either from the <literal>@AutoConfigureStubRunner</literal> annotation, the
JUnit rule or properties, it&#8217;s enough to pass the URL of the
SCM repository, prefixed with the protocol. For example</simpara>
<programlisting language="java" linenumbering="unnumbered">@AutoConfigureStubRunner(
stubsMode="REMOTE",
repositoryRoot="git://https://github.com/spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git",
ids="com.example:bookstore:0.0.1.RELEASE"
)</programlisting>
<simpara>With such a setup:</simpara>
<itemizedlist>
<listitem>
<simpara>Git project will be cloned to a temporary directory</simpara>
</listitem>
<listitem>
<simpara>The SCM stub downloader will go to <literal>META-INF/groupId/artifactId/version/</literal> folder
to find stub definitions and contracts. E.g. for <literal>com.example:foo:1.0.0</literal> the path would be
<literal>META-INF/com.example/foo/1.0.0/</literal></simpara>
</listitem>
<listitem>
<simpara>Stub servers will be started and fed with mappings</simpara>
</listitem>
<listitem>
<simpara>Messaging definitions will be read and used in the messaging tests</simpara>
</listitem>
</itemizedlist>
</section>
</section>
<section xml:id="_how_can_i_debug_the_request_response_being_sent_by_the_generated_tests_client">
<title>How can I debug the request/response being sent by the generated tests client?</title>
@@ -1956,11 +2157,6 @@ matching response definition was picked.</simpara>
to dump all mappings per artifact id. Also the port at which the given stub server was
started will be attached.</simpara>
</section>
<section xml:id="_can_i_reference_the_request_from_the_response">
<title>Can I reference the request from the response?</title>
<simpara>Yes! With version 1.1.0 we&#8217;ve added such a possibility. On the HTTP stub server side we&#8217;re providing support
for this for WireMock. In case of other HTTP server stubs you&#8217;ll have to implement the approach yourself.</simpara>
</section>
<section xml:id="_can_i_reference_text_from_file">
<title>Can I reference text from file?</title>
<simpara>Yes! With version 1.2.0 we&#8217;ve added such a possibility. It&#8217;s enough to call <literal>file(&#8230;&#8203;)</literal> method in the
@@ -2022,6 +2218,9 @@ following sections:</simpara>
<simpara><xref linkend="gradle-invoking-generated-tests"/></simpara>
</listitem>
<listitem>
<simpara><xref linkend="gradle-pushing-stubs-to-scm"/></simpara>
</listitem>
<listitem>
<simpara><xref linkend="gradle-consumer"/></simpara>
</listitem>
</itemizedlist>
@@ -2251,6 +2450,10 @@ the Groovy DSL should be placed.</simpara>
<simpara><emphasis role="strong">targetFramework</emphasis>: Specifies the target test framework to be used. Currently, Spock and
JUnit are supported with JUnit being the default framework.</simpara>
</listitem>
<listitem>
<simpara><emphasis role="strong">contractsProperties</emphasis>: a map containing properties to be passed to Spring Cloud Contract
components. Those properties might be used by e.g. inbuilt or custom Stub Downloaders.</simpara>
</listitem>
</itemizedlist>
<simpara>The following properties are used when you want to specify the location of the JAR
containing the contracts:
@@ -2336,6 +2539,19 @@ generated from <literal>src/test/resources/contract/com/</literal> contracts ext
<simpara>To ensure that the provider side is compliant with defined contracts, you need to invoke:</simpara>
<programlisting language="bash" linenumbering="unnumbered">./gradlew generateContractTests test</programlisting>
</section>
<section xml:id="gradle-pushing-stubs-to-scm">
<title>Pushing stubs to SCM</title>
<simpara>If you&#8217;re using the SCM repository to keep the contracts and
stubs, you might want to automate the step of pushing stubs to
the repository. To do that, it&#8217;s enough to call the <literal>pushStubsToScm</literal>
task. Example:</simpara>
<programlisting language="bash" linenumbering="unnumbered">$ ./gradlew pushStubsToScm</programlisting>
<simpara>Under <xref linkend="scm-stub-downloader"/> you can find all possible
configuration options that you can pass either via
the <literal>contractsProperties</literal> field e.g. <literal>contracts { contractsProperties = [foo:"bar"] }</literal>,
via <literal>contractsProperties</literal> method e.g. <literal>contracts { contractsProperties([foo:"bar"]) }</literal>,
a system property or an environment variable.</simpara>
</section>
<section xml:id="gradle-consumer">
<title>Spring Cloud Contract Verifier on the Consumer Side</title>
<simpara>In a consuming service, you need to configure the Spring Cloud Contract Verifier plugin
@@ -2408,6 +2624,9 @@ following sections:</simpara>
<simpara><xref linkend="maven-invoking-generated-tests"/></simpara>
</listitem>
<listitem>
<simpara><xref linkend="maven-pushing-stubs-to-scm"/></simpara>
</listitem>
<listitem>
<simpara><xref linkend="maven-sts"/></simpara>
</listitem>
</itemizedlist>
@@ -2646,6 +2865,10 @@ the matched contract. For example, if you have a contract under
extends <literal>com.example.base.BaseClass</literal>. This setting takes precedence over
<emphasis role="strong">packageWithBaseClasses</emphasis> and <emphasis role="strong">baseClassForTests</emphasis>.</simpara>
</listitem>
<listitem>
<simpara><emphasis role="strong">contractsProperties</emphasis>: a map containing properties to be passed to Spring Cloud Contract
components. Those properties might be used by e.g. inbuilt or custom Stub Downloaders.</simpara>
</listitem>
</itemizedlist>
<simpara>If you want to download your contract definitions from a Maven repository, you can use
the following options:</simpara>
@@ -2841,13 +3064,58 @@ goal.</simpara>
<simpara>To ensure that provider side is compliant with defined contracts, you need to invoke
<literal>mvn generateTest test</literal>.</simpara>
</section>
<section xml:id="maven-pushing-stubs-to-scm">
<title>Pushing stubs to SCM</title>
<simpara>If you&#8217;re using the SCM repository to keep the contracts and
stubs, you might want to automate the step of pushing stubs to
the repository. To do that, it&#8217;s enough to add the <literal>pushStubsToScm</literal>
goal. Example:</simpara>
<programlisting language="xml" linenumbering="unnumbered">&lt;plugin&gt;
&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
&lt;artifactId&gt;spring-cloud-contract-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;${spring-cloud-contract.version}&lt;/version&gt;
&lt;extensions&gt;true&lt;/extensions&gt;
&lt;configuration&gt;
&lt;!-- Base class mappings etc. --&gt;
&lt;!-- We want to pick contracts from a Git repository --&gt;
&lt;contractsRepositoryUrl&gt;git://https://github.com/spring-cloud-samples/spring-cloud-contract-nodejs-contracts-git.git&lt;/contractsRepositoryUrl&gt;
&lt;!-- We reuse the contract dependency section to set up the path
to the folder that contains the contract definitions. In our case the
path will be /groupId/artifactId/version/contracts --&gt;
&lt;contractDependency&gt;
&lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
&lt;artifactId&gt;${project.artifactId}&lt;/artifactId&gt;
&lt;version&gt;${project.version}&lt;/version&gt;
&lt;/contractDependency&gt;
&lt;!-- The contracts mode can't be classpath --&gt;
&lt;contractsMode&gt;REMOTE&lt;/contractsMode&gt;
&lt;/configuration&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;phase&gt;package&lt;/phase&gt;
&lt;goals&gt;
&lt;!-- By default we will not push the stubs back to SCM,
you have to explicitly add it as a goal --&gt;
&lt;goal&gt;pushStubsToScm&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;</programlisting>
<simpara>Under <xref linkend="scm-stub-downloader"/> you can find all possible
configuration options that you can pass either via
the <literal>&lt;configuration&gt;&lt;contractProperties&gt;</literal> map, a system property
or an environment variable.</simpara>
</section>
<section xml:id="maven-sts">
<title>Maven Plugin and STS</title>
<simpara>If you see the following exception while using STS:</simpara>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/1.2.x/docs/src/main/asciidoc/images/sts_exception.png"/>
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images/sts_exception.png"/>
</imageobject>
<textobject><phrase>STS Exception</phrase></textobject>
</mediaobject>
@@ -8608,6 +8876,67 @@ If you provide the <literal>stubsMode = StubRunnerProperties.StubsMode.LOCAL</li
If you provide more than one, then the first one on the list is used.</simpara>
</important>
</section>
<section xml:id="scm-stub-downloader">
<title>Using the SCM Stub Downloader</title>
<simpara>Whenever the <literal>repositoryRoot</literal> starts with a SCM protocol
(currently we support only <literal>git://</literal>), the stub downloader will try
to clone the repository and use it as a source of contracts
to generate tests or stubs.</simpara>
<simpara>Either via environment variables, system properties, properties set
inside the plugin or contracts repository configuration you can
tweak the downloader&#8217;s behaviour. Below you can find the list of
properties</simpara>
<table frame="all" rowsep="1" colsep="1">
<title>SCM Stub Downloader properties</title>
<tgroup cols="3">
<colspec colname="col_1" colwidth="33.3333*"/>
<colspec colname="col_2" colwidth="33.3333*"/>
<colspec colname="col_3" colwidth="33.3334*"/>
<tbody>
<row>
<entry align="left" valign="top"><simpara>Type of a property</simpara></entry>
<entry align="left" valign="top"><simpara>Name of the property</simpara></entry>
<entry align="left" valign="top"><simpara>Description</simpara></entry>
</row>
<row>
<entry align="left" valign="top"><simpara>* <literal>git.branch</literal> (plugin prop)
* <literal>stubrunner.properties.git.branch</literal> (system prop)
* <literal>STUBRUNNER_PROPERTIES_GIT_BRANCH</literal> (env prop)</simpara></entry>
<entry align="left" valign="top"><simpara>master</simpara></entry>
<entry align="left" valign="top"><simpara>Which branch to checkout</simpara></entry>
</row>
<row>
<entry align="left" valign="top"><simpara>* <literal>git.username</literal> (plugin prop)
* <literal>stubrunner.properties.git.username</literal> (system prop)
* <literal>STUBRUNNER_PROPERTIES_GIT_USERNAME</literal> (env prop)</simpara></entry>
<entry align="left" valign="top"></entry>
<entry align="left" valign="top"><simpara>Git clone username</simpara></entry>
</row>
<row>
<entry align="left" valign="top"><simpara>* <literal>git.password</literal> (plugin prop)
* <literal>stubrunner.properties.git.password</literal> (system prop)
* <literal>STUBRUNNER_PROPERTIES_GIT_PASSWORD</literal> (env prop)</simpara></entry>
<entry align="left" valign="top"></entry>
<entry align="left" valign="top"><simpara>Git clone password</simpara></entry>
</row>
<row>
<entry align="left" valign="top"><simpara>* <literal>git.no-of-attempts</literal> (plugin prop)
* <literal>stubrunner.properties.git.no-of-attempts</literal> (system prop)
* <literal>STUBRUNNER_PROPERTIES_GIT_NO_OF_ATTEMPTS</literal> (env prop)</simpara></entry>
<entry align="left" valign="top"><simpara>10</simpara></entry>
<entry align="left" valign="top"><simpara>Number of attempts to push the commits to <literal>origin</literal></simpara></entry>
</row>
<row>
<entry align="left" valign="top"><simpara>* <literal>git.wait-between-attempts</literal> (Plugin prop)
* <literal>stubrunner.properties.git.wait-between-attempts</literal> (system prop)
* <literal>STUBRUNNER_PROPERTIES_GIT_WAIT_BETWEEN_ATTEMPTS</literal> (env prop)</simpara></entry>
<entry align="left" valign="top"><simpara>1000</simpara></entry>
<entry align="left" valign="top"><simpara>Number of millis to wait between attempts to push the commits to <literal>origin</literal></simpara></entry>
</row>
</tbody>
</tgroup>
</table>
</section>
</chapter>
<chapter xml:id="_spring_cloud_contract_wiremock">
<title>Spring Cloud Contract WireMock</title>
@@ -9012,6 +9341,10 @@ contract. The location of this file would be <literal>index/dsl-contract.adoc</l
</chapter>
<chapter xml:id="_migrations">
<title>Migrations</title>
<tip>
<simpara>For up to date migration guides please visit
the project&#8217;s <link xl:href="https://github.com/spring-cloud/spring-cloud-contract/wiki/">wiki page</link>.</simpara>
</tip>
<simpara>This section covers migrating from one version of Spring Cloud Contract Verifier to the
next version. It covers the following versions upgrade paths:</simpara>
<section xml:id="cloud-verifier-1.0-1.1">