Sync docs from master to gh-pages

This commit is contained in:
buildmaster
2017-03-10 12:20:12 +00:00
parent ffc1c05e51
commit 9f77d2e2c7
2 changed files with 111 additions and 45 deletions

BIN
images/sts_exception.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@@ -572,7 +572,6 @@ $(addBlockSwitches);
<ul class="sectlevel5">
<li><a href="#_add_gradle_plugin_with_dependencies">Add gradle plugin with dependencies</a></li>
<li><a href="#_snapshot_versions_for_gradle">Snapshot versions for Gradle</a></li>
<li><a href="#_add_maven_plugin_with_dependencies">Add maven plugin with dependencies</a></li>
<li><a href="#_add_stubs">Add stubs</a></li>
</ul>
</li>
@@ -606,6 +605,11 @@ $(addBlockSwitches);
</ul>
</li>
<li><a href="#_invoking_generated_tests_2">Invoking generated tests</a></li>
<li><a href="#_faq_with_maven_plugin">FAQ with Maven Plugin</a>
<ul class="sectlevel5">
<li><a href="#_maven_plugin_and_sts">Maven Plugin and STS</a></li>
</ul>
</li>
<li><a href="#_spring_cloud_contract_verifier_on_consumer_side_2">Spring Cloud Contract Verifier on consumer side</a></li>
</ul>
</li>
@@ -657,7 +661,11 @@ $(addBlockSwitches);
</li>
<li><a href="#_stub_runner_spring_cloud">Stub Runner Spring Cloud</a>
<ul class="sectlevel3">
<li><a href="#_stubbing_service_discovery">Stubbing Service Discovery</a></li>
<li><a href="#_stubbing_service_discovery">Stubbing Service Discovery</a>
<ul class="sectlevel4">
<li><a href="#_test_profiles_and_service_discovery">Test profiles and service discovery</a></li>
</ul>
</li>
<li><a href="#_additional_configuration">Additional Configuration</a></li>
</ul>
</li>
@@ -3017,49 +3025,6 @@ dependencies {
</div>
</div>
<div class="sect5">
<h6 id="_add_maven_plugin_with_dependencies">Add maven plugin with dependencies</h6>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-xml" data-lang="xml">&lt;dependencyManagement&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
&lt;artifactId&gt;spring-cloud-contract-dependencies&lt;/artifactId&gt;
&lt;version&gt;${spring-cloud-contract.version}&lt;/version&gt;
&lt;type&gt;pom&lt;/type&gt;
&lt;scope&gt;import&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/dependencyManagement&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
&lt;artifactId&gt;spring-cloud-starter-contract-verifier&lt;/artifactId&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
&lt;artifactId&gt;spring-cloud-contract-maven-plugin&lt;/artifactId&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;goals&gt;
&lt;goal&gt;convert&lt;/goal&gt;
&lt;goal&gt;generateStubs&lt;/goal&gt;
&lt;goal&gt;generateTests&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;</code></pre>
</div>
</div>
<div class="paragraph">
<p>Read more: <a href="https://cloud.spring.io/spring-cloud-contract/spring-cloud-contract-maven-plugin/">spring-cloud-contract-maven-plugin</a></p>
</div>
</div>
<div class="sect5">
<h6 id="_add_stubs">Add stubs</h6>
<div class="paragraph">
<p>By default Spring Cloud Contract Verifier is looking for stubs in <code>src/test/resources/contracts</code> directory.</p>
@@ -3725,6 +3690,73 @@ will be extending the <code>com.example.ComBase</code> whereas the rest of tests
</div>
</div>
<div class="sect4">
<h5 id="_faq_with_maven_plugin">FAQ with Maven Plugin</h5>
<div class="sect5">
<h6 id="_maven_plugin_and_sts">Maven Plugin and STS</h6>
<div class="paragraph">
<p>In case you see the following exception while using STS</p>
</div>
<div class="imageblock">
<div class="content">
<img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/1.0.x/docs/src/main/asciidoc/images/sts_exception.png" alt="STS Exception">
</div>
</div>
<div class="paragraph">
<p>when you click on the marker you should see sth like this</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-bash" data-lang="bash"> plugin:1.1.0.M1:convert:default-convert:process-test-resources) org.apache.maven.plugin.PluginExecutionException: Execution default-convert of goal org.springframework.cloud:spring-
cloud-contract-maven-plugin:1.1.0.M1:convert failed. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331) at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362) at
...
org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by: java.lang.NullPointerException at
org.eclipse.m2e.core.internal.builder.plexusbuildapi.EclipseIncrementalBuildContext.hasDelta(EclipseIncrementalBuildContext.java:53) at
org.sonatype.plexus.build.incremental.ThreadBuildContext.hasDelta(ThreadBuildContext.java:59) at</code></pre>
</div>
</div>
<div class="paragraph">
<p>In order to fix this issue just provide the following section in your <code>pom.xml</code></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-xml" data-lang="xml">&lt;build&gt;
&lt;pluginManagement&gt;
&lt;plugins&gt;
&lt;!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. --&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.eclipse.m2e&lt;/groupId&gt;
&lt;artifactId&gt;lifecycle-mapping&lt;/artifactId&gt;
&lt;version&gt;1.0.0&lt;/version&gt;
&lt;configuration&gt;
&lt;lifecycleMappingMetadata&gt;
&lt;pluginExecutions&gt;
&lt;pluginExecution&gt;
&lt;pluginExecutionFilter&gt;
&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
&lt;artifactId&gt;spring-cloud-contract-maven-plugin&lt;/artifactId&gt;
&lt;versionRange&gt;[1.0,)&lt;/versionRange&gt;
&lt;goals&gt;
&lt;goal&gt;convert&lt;/goal&gt;
&lt;/goals&gt;
&lt;/pluginExecutionFilter&gt;
&lt;action&gt;
&lt;execute /&gt;
&lt;/action&gt;
&lt;/pluginExecution&gt;
&lt;/pluginExecutions&gt;
&lt;/lifecycleMappingMetadata&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/pluginManagement&gt;
&lt;/build&gt;</code></pre>
</div>
</div>
</div>
</div>
<div class="sect4">
<h5 id="_spring_cloud_contract_verifier_on_consumer_side_2">Spring Cloud Contract Verifier on consumer side</h5>
<div class="paragraph">
<p>You can actually use the Spring Cloud Contract Verifier also for the consumer side!
@@ -4888,6 +4920,19 @@ for every registered WireMock server. Example for Stub Runner ids
<div class="paragraph">
<p>Stub Runner can integrate with Spring Cloud.</p>
</div>
<div class="paragraph">
<p>For real life examples you can check the</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/master/producer">producer app sample</a></p>
</li>
<li>
<p><a href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/master/consumer_with_discovery">consumer app sample</a></p>
</li>
</ul>
</div>
<div class="sect3">
<h4 id="_stubbing_service_discovery">Stubbing Service Discovery</h4>
<div class="paragraph">
@@ -4939,6 +4984,27 @@ stubrunner:
fraudDetectionServer: someNameThatShouldMapFraudDetectionServer</code></pre>
</div>
</div>
<div class="sect4">
<h5 id="_test_profiles_and_service_discovery">Test profiles and service discovery</h5>
<div class="paragraph">
<p>In your integration tests you typically don&#8217;t want to call neither a discovery service (e.g. Eureka)
or Config Server. That&#8217;s why you create an additional test configuration in which you want to disable
these features.</p>
</div>
<div class="paragraph">
<p>Due to certain limitations of <a href="https://github.com/spring-cloud/spring-cloud-commons/issues/156"><code>spring-cloud-commons</code></a> to achieve this you have disable these properties
via a static block like presented below (example for Eureka)</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-java" data-lang="java"> //Hack to work around https://github.com/spring-cloud/spring-cloud-commons/issues/156
static {
System.setProperty("eureka.client.enabled", "false");
System.setProperty("spring.cloud.config.failFast", "false");
}</code></pre>
</div>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_additional_configuration">Additional Configuration</h4>