Sync docs from 2.1.x to gh-pages
This commit is contained in:
@@ -82,7 +82,7 @@ It can be related to security issues where the consumers can’t clone the p
|
||||
contracts in a single place then you, as a producer, will know how many consumers you have and which
|
||||
consumer you will 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 Repo structure</h3></div></div></div><p>Let’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/master/samples/standalone/contracts" target="_top">here</a>):</p><pre class="programlisting">├── com
|
||||
(which you can checkout <a class="link" href="https://github.com/spring-cloud/spring-cloud-contract/tree/2.1.x/samples/standalone/contracts" target="_top">here</a>):</p><pre class="programlisting">├── com
|
||||
│ └── example
|
||||
│ └── server
|
||||
│ ├── client1
|
||||
@@ -116,15 +116,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"><parent></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-parent<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>2.2.0.BUILD-SNAPSHOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>2.1.3.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><relativePath/></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></parent></span>
|
||||
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><properties></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><project.build.sourceEncoding></span>UTF-8<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></project.build.sourceEncoding></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><java.version></span>1.8<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></java.version></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><spring-cloud-contract.version></span>2.2.0.BUILD-SNAPSHOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></spring-cloud-contract.version></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><spring-cloud-release.version></span>Hoxton.BUILD-SNAPSHOT
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><spring-cloud-contract.version></span>2.1.2.BUILD-SNAPSHOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></spring-cloud-contract.version></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><spring-cloud-release.version></span>Greenwich.BUILD-SNAPSHOT
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></spring-cloud-release.version></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><excludeBuildFolders></span>true<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></excludeBuildFolders></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></properties></span>
|
||||
|
||||
@@ -207,8 +207,8 @@ producer stubs.</p></td></tr></table></div><p>The producer would setup the contr
|
||||
└── com.example
|
||||
└── beer-api-producer-restdocs
|
||||
└── nested
|
||||
└── contract3.groovy</pre><p>To achieve proper stub packaging.</p><p>Or using the <a class="link" href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.0.x/producer_with_restdocs/pom.xml" target="_top">Maven <code class="literal">assembly</code> plugin</a> or
|
||||
<a class="link" href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.0.x/producer_with_restdocs/build.gradle" target="_top">Gradle Jar</a> task you have to create the following
|
||||
└── contract3.groovy</pre><p>To achieve proper stub packaging.</p><p>Or using the <a class="link" href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.1.x/producer_with_restdocs/pom.xml" target="_top">Maven <code class="literal">assembly</code> plugin</a> or
|
||||
<a class="link" href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.1.x/producer_with_restdocs/build.gradle" target="_top">Gradle Jar</a> task you have to create the following
|
||||
structure in your stubs jar.</p><pre class="programlisting">└── META-INF
|
||||
└── com.example
|
||||
└── beer-api-producer-restdocs
|
||||
@@ -614,7 +614,7 @@ Value of the annotation can be the <code class="literal">groupid:artifactid</cod
|
||||
<code class="literal">com.example:foo</code>, <code class="literal">com.example:bar</code>.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@StubRunnerPort("foo")</span></em>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">int</span> fooPort;
|
||||
<em><span class="hl-annotation" style="color: gray">@StubRunnerPort("com.example:bar")</span></em>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">int</span> barPort;</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_stub_runner_spring_cloud" href="#_stub_runner_spring_cloud"></a>6.5 Stub Runner Spring Cloud</h2></div></div></div><p>Stub Runner can integrate with Spring Cloud.</p><p>For real life examples you can check the</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/2.0.x/producer" target="_top">producer app sample</a></li><li class="listitem"><a class="link" href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/2.0.x/consumer_with_discovery" target="_top">consumer app sample</a></li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_stubbing_service_discovery" href="#_stubbing_service_discovery"></a>6.5.1 Stubbing Service Discovery</h3></div></div></div><p>The most important feature of <code class="literal">Stub Runner Spring Cloud</code> is the fact that it’s stubbing</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">DiscoveryClient</code></li><li class="listitem"><code class="literal">Ribbon</code> <code class="literal">ServerList</code></li></ul></div><p>that means that regardless of the fact whether you’re using Zookeeper, Consul, Eureka or anything else, you don’t need that in your tests.
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">int</span> barPort;</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_stub_runner_spring_cloud" href="#_stub_runner_spring_cloud"></a>6.5 Stub Runner Spring Cloud</h2></div></div></div><p>Stub Runner can integrate with Spring Cloud.</p><p>For real life examples you can check the</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/2.1.x/producer" target="_top">producer app sample</a></li><li class="listitem"><a class="link" href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/2.1.x/consumer_with_discovery" target="_top">consumer app sample</a></li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_stubbing_service_discovery" href="#_stubbing_service_discovery"></a>6.5.1 Stubbing Service Discovery</h3></div></div></div><p>The most important feature of <code class="literal">Stub Runner Spring Cloud</code> is the fact that it’s stubbing</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">DiscoveryClient</code></li><li class="listitem"><code class="literal">Ribbon</code> <code class="literal">ServerList</code></li></ul></div><p>that means that regardless of the fact whether you’re using Zookeeper, Consul, Eureka or anything else, you don’t need that in your tests.
|
||||
We’re starting WireMock instances of your dependencies and we’re telling your application whenever you’re using <code class="literal">Feign</code>, load balanced <code class="literal">RestTemplate</code>
|
||||
or <code class="literal">DiscoveryClient</code> directly, to call those stubbed servers instead of calling the real Service Discovery tool.</p><p>For example this test will pass</p><pre class="programlisting">def <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'should make service discovery work'</span>() {
|
||||
expect: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'WireMocks are running'</span>
|
||||
|
||||
@@ -10,14 +10,14 @@ own integrations.</li><li class="listitem">Acceptance tests (in JUnit 4, JUnit 5
|
||||
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="_history" href="#_history"></a>2.1 History</h2></div></div></div><p>Before becoming Spring Cloud Contract, this project was called <a class="link" href="https://github.com/Codearte/accurest" target="_top">Accurest</a>.
|
||||
It was created by <a class="link" href="https://twitter.com/mgrzejszczak" target="_top">Marcin Grzejszczak</a> and <a class="link" href="https://twitter.com/jkubrynski" target="_top">Jakub Kubrynski</a>
|
||||
from (<a class="link" href="https://github.com/Codearte" target="_top">Codearte</a>.</p><p>The <code class="literal">0.1.0</code> release took place on 26 Jan 2015 and it became stable with <code class="literal">1.0.0</code> release on 29 Feb 2016.</p></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.2 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.2.1 Testing issues</h3></div></div></div><p>If we wanted to test the application in top left corner to determine whether it can
|
||||
from (<a class="link" href="https://github.com/Codearte" target="_top">Codearte</a>.</p><p>The <code class="literal">0.1.0</code> release took place on 26 Jan 2015 and it became stable with <code class="literal">1.0.0</code> release on 29 Feb 2016.</p></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.2 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/2.1.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.2.1 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/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
|
||||
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/2.1.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
|
||||
created by the service that you’re calling. Also, if you can use them, it means that they
|
||||
were tested against the producer’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.3 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
|
||||
@@ -425,8 +425,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/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
|
||||
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/2.1.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/2.1.x/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’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.5.1 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. </b>
|
||||
|
||||
@@ -544,7 +544,7 @@ goal. Example:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span></pre><p>Under <a class="xref" href="multi__using_the_pluggable_architecture.html#scm-stub-downloader" title="10.6 Using the SCM Stub Downloader">Section 10.6, “Using the SCM Stub Downloader”</a> you can find all possible
|
||||
configuration options that you can pass either via
|
||||
the <code class="literal"><configuration><contractProperties></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 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-
|
||||
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 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/2.1.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-
|
||||
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
|
||||
...
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>11. Spring Cloud Contract WireMock</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.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__using_the_pluggable_architecture.html" title="10. Using the Pluggable Architecture"><link rel="next" href="multi__migrations.html" title="12. Migrations"></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">11. Spring Cloud Contract WireMock</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__using_the_pluggable_architecture.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__migrations.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_spring_cloud_contract_wiremock" href="#_spring_cloud_contract_wiremock"></a>11. Spring Cloud Contract WireMock</h1></div></div></div><p>The Spring Cloud Contract WireMock modules let you use <a class="link" href="https://github.com/tomakehurst/wiremock" target="_top">WireMock</a> in a
|
||||
Spring Boot application. Check out the
|
||||
<a class="link" href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples" target="_top">samples</a>
|
||||
<a class="link" href="https://github.com/spring-cloud/spring-cloud-contract/tree/2.1.x/samples" target="_top">samples</a>
|
||||
for more details.</p><p>If you have a Spring Boot application that uses Tomcat as an embedded server (which is
|
||||
the default with <code class="literal">spring-boot-starter-web</code>), you can add
|
||||
<code class="literal">spring-cloud-starter-contract-stub-runner</code> to your classpath and add <code class="literal">@AutoConfigureWireMock</code> in
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -361,10 +361,10 @@ examples of Maven plugin setup.</p>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.0.x/producer/pom.xml">Producer application with a test dependency added to the plugin</a></p>
|
||||
<p><a href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.1.x/producer/pom.xml">Producer application with a test dependency added to the plugin</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.0.x/producer/pom.xml">Producer application referencing a repo with contracts and regular expression based base class mapping</a></p>
|
||||
<p><a href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.1.x/producer/pom.xml">Producer application referencing a repo with contracts and regular expression based base class mapping</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -326,7 +326,7 @@
|
||||
<div class="sect2">
|
||||
<h3 id="project_source_code">Project source code</h3>
|
||||
<div class="paragraph">
|
||||
<p><a href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-java" class="bare">https://github.com/spring-cloud/spring-cloud-contract/tree/master/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-java</a></p>
|
||||
<p><a href="https://github.com/spring-cloud/spring-cloud-contract/tree/2.1.x/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-java" class="bare">https://github.com/spring-cloud/spring-cloud-contract/tree/2.1.x/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-java</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -371,7 +371,7 @@
|
||||
<div class="sect2">
|
||||
<h3 id="project_source_code">Project source code</h3>
|
||||
<div class="paragraph">
|
||||
<p><a href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-groovy" class="bare">https://github.com/spring-cloud/spring-cloud-contract/tree/master/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-groovy</a></p>
|
||||
<p><a href="https://github.com/spring-cloud/spring-cloud-contract/tree/2.1.x/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-groovy" class="bare">https://github.com/spring-cloud/spring-cloud-contract/tree/2.1.x/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-groovy</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -56,7 +56,7 @@ from (<link xl:href="https://github.com/Codearte">Codearte</link>.</simpara>
|
||||
<informalfigure>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images/Deps.png"/>
|
||||
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/2.1.x/docs/src/main/asciidoc/images/Deps.png"/>
|
||||
</imageobject>
|
||||
<textobject><phrase>Microservices Architecture</phrase></textobject>
|
||||
</mediaobject>
|
||||
@@ -131,7 +131,7 @@ are those that your application directly uses.</simpara>
|
||||
<informalfigure>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images/Stubs2.png"/>
|
||||
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/2.1.x/docs/src/main/asciidoc/images/Stubs2.png"/>
|
||||
</imageobject>
|
||||
<textobject><phrase>Stubbed Services</phrase></textobject>
|
||||
</mediaobject>
|
||||
@@ -748,8 +748,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/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
|
||||
<simpara>The <link xl:href="https://github.com/spring-cloud/spring-cloud-contract/tree/2.1.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/2.1.x/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
|
||||
@@ -1588,7 +1588,7 @@ consumer you will break with your local changes.</simpara>
|
||||
<title>Repo structure</title>
|
||||
<simpara>Let’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/master/samples/standalone/contracts">here</link>):</simpara>
|
||||
(which you can checkout <link xl:href="https://github.com/spring-cloud/spring-cloud-contract/tree/2.1.x/samples/standalone/contracts">here</link>):</simpara>
|
||||
<programlisting language="bash" linenumbering="unnumbered">├── com
|
||||
│ └── example
|
||||
│ └── server
|
||||
@@ -1626,15 +1626,15 @@ one to one to the contents of the repo.</simpara>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.1.3.RELEASE</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud-contract.version>2.2.0.BUILD-SNAPSHOT</spring-cloud-contract.version>
|
||||
<spring-cloud-release.version>Hoxton.BUILD-SNAPSHOT
|
||||
<spring-cloud-contract.version>2.1.2.BUILD-SNAPSHOT</spring-cloud-contract.version>
|
||||
<spring-cloud-release.version>Greenwich.BUILD-SNAPSHOT
|
||||
</spring-cloud-release.version>
|
||||
<excludeBuildFolders>true</excludeBuildFolders>
|
||||
</properties>
|
||||
@@ -3521,7 +3521,7 @@ or an environment variable.</simpara>
|
||||
<informalfigure>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images/sts_exception.png"/>
|
||||
<imagedata fileref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/2.1.x/docs/src/main/asciidoc/images/sts_exception.png"/>
|
||||
</imageobject>
|
||||
<textobject><phrase>STS Exception</phrase></textobject>
|
||||
</mediaobject>
|
||||
@@ -4592,8 +4592,8 @@ producer stubs.</simpara>
|
||||
└── nested
|
||||
└── contract3.groovy</programlisting>
|
||||
<simpara>To achieve proper stub packaging.</simpara>
|
||||
<simpara>Or using the <link xl:href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.0.x/producer_with_restdocs/pom.xml">Maven <literal>assembly</literal> plugin</link> or
|
||||
<link xl:href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.0.x/producer_with_restdocs/build.gradle">Gradle Jar</link> task you have to create the following
|
||||
<simpara>Or using the <link xl:href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.1.x/producer_with_restdocs/pom.xml">Maven <literal>assembly</literal> plugin</link> or
|
||||
<link xl:href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/2.1.x/producer_with_restdocs/build.gradle">Gradle Jar</link> task you have to create the following
|
||||
structure in your stubs jar.</simpara>
|
||||
<programlisting language="bash" linenumbering="unnumbered">└── META-INF
|
||||
└── com.example
|
||||
@@ -5136,10 +5136,10 @@ int barPort;</programlisting>
|
||||
<simpara>For real life examples you can check the</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara><link xl:href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/2.0.x/producer">producer app sample</link></simpara>
|
||||
<simpara><link xl:href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/2.1.x/producer">producer app sample</link></simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara><link xl:href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/2.0.x/consumer_with_discovery">consumer app sample</link></simpara>
|
||||
<simpara><link xl:href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/2.1.x/consumer_with_discovery">consumer app sample</link></simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<section xml:id="_stubbing_service_discovery">
|
||||
@@ -10346,7 +10346,7 @@ properties</simpara>
|
||||
<title>Spring Cloud Contract WireMock</title>
|
||||
<simpara>The Spring Cloud Contract WireMock modules let you use <link xl:href="https://github.com/tomakehurst/wiremock">WireMock</link> in a
|
||||
Spring Boot application. Check out the
|
||||
<link xl:href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples">samples</link>
|
||||
<link xl:href="https://github.com/spring-cloud/spring-cloud-contract/tree/2.1.x/samples">samples</link>
|
||||
for more details.</simpara>
|
||||
<simpara>If you have a Spring Boot application that uses Tomcat as an embedded server (which is
|
||||
the default with <literal>spring-boot-starter-web</literal>), you can add
|
||||
|
||||
Reference in New Issue
Block a user