Sync docs from master to gh-pages

This commit is contained in:
Marcin Grzejszczak
2016-07-20 15:03:20 +02:00
parent 779bae9c44
commit 6cc1d051b9
74 changed files with 3055 additions and 305 deletions

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>ConvertMojo</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_class">ConvertMojo</span></div><h1>ConvertMojo</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">18 of 106</td><td class="ctr2">83%</td><td class="bar">3 of 6</td><td class="ctr2">50%</td><td class="ctr1">3</td><td class="ctr2">6</td><td class="ctr1">3</td><td class="ctr2">20</td><td class="ctr1">0</td><td class="ctr2">3</td></tr></tfoot><tbody><tr><td id="a1"><a href="ConvertMojo.java.html#L80" class="el_method">execute()</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="22" height="10" title="18" alt="18"/><img src="../.resources/greenbar.gif" width="97" height="10" title="80" alt="80"/></td><td class="ctr2" id="c2">82%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="60" height="10" title="3" alt="3"/><img src="../.resources/greenbar.gif" width="60" height="10" title="3" alt="3"/></td><td class="ctr2" id="e0">50%</td><td class="ctr1" id="f0">3</td><td class="ctr2" id="g0">4</td><td class="ctr1" id="h0">3</td><td class="ctr2" id="i0">18</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a2"><a href="ConvertMojo.java.html#L109" class="el_method">isInsideProject()</a></td><td class="bar" id="b1"><img src="../.resources/greenbar.gif" width="6" height="10" title="5" alt="5"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d1"/><td class="ctr2" id="e1">n/a</td><td class="ctr1" id="f1">0</td><td class="ctr2" id="g1">1</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i1">1</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a0"><a href="ConvertMojo.java.html#L41" class="el_method">ConvertMojo()</a></td><td class="bar" id="b2"><img src="../.resources/greenbar.gif" width="3" height="10" title="3" alt="3"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i2">1</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>ConvertMojo.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.source.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_source">ConvertMojo.java</span></div><h1>ConvertMojo.java</h1><pre class="source lang-java linenums">/*
* Copyright 2013-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.contract.maven.verifier;
import java.io.File;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.filtering.MavenResourcesFiltering;
import org.springframework.cloud.contract.verifier.config.ContractVerifierConfigProperties;
import org.springframework.cloud.contract.verifier.wiremock.DslToWireMockClientConverter;
import org.springframework.cloud.contract.verifier.wiremock.RecursiveFilesConverter;
/**
* Convert Spring Cloud Contract Verifier contracts into WireMock stubs mappings.
* &lt;p&gt;
* This goal allows you to generate `stubs-jar` or execute `spring-cloud-contract:run` with generated WireMock mappings.
*/
@Mojo(name = &quot;convert&quot;, requiresProject = false,
defaultPhase = LifecyclePhase.PROCESS_TEST_RESOURCES)
<span class="fc" id="L41">public class ConvertMojo extends AbstractMojo {</span>
/**
* Directory containing Spring Cloud Contract Verifier contracts written using the GroovyDSL
*/
@Parameter(defaultValue = &quot;${basedir}/src/test/resources/contracts&quot;)
private File contractsDirectory;
/**
* Directory where the generated WireMock stubs from Groovy DSL should be placed.
* You can then mention them in your packaging task to create jar with stubs
*/
@Parameter(defaultValue = &quot;${project.build.directory}/stubs&quot;)
private File outputDirectory;
/**
* Directory containing contracts written using the GroovyDSL
* &lt;p&gt;
* This parameter is only used when goal is executed outside of maven project.
*/
@Parameter(property = &quot;contractsDirectory&quot;, defaultValue = &quot;${basedir}&quot;)
private File source;
@Parameter(property = &quot;stubsDirectory&quot;, defaultValue = &quot;${basedir}&quot;)
private File destination;
@Parameter(property = &quot;spring.cloud.contract.verifier.skip&quot;, defaultValue = &quot;false&quot;)
private boolean skip;
@Parameter(defaultValue = &quot;${session}&quot;, readonly = true)
private MavenSession mavenSession;
@Parameter(defaultValue = &quot;${project}&quot;, readonly = true) private MavenProject project;
@Component(role = MavenResourcesFiltering.class, hint = &quot;default&quot;)
private MavenResourcesFiltering mavenResourcesFiltering;
public void execute() throws MojoExecutionException, MojoFailureException {
<span class="pc bpc" id="L80" title="1 of 2 branches missed."> if (skip) {</span>
<span class="nc" id="L81"> getLog().info(String.format(</span>
&quot;Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip=%s&quot;,
<span class="nc" id="L83"> skip));</span>
<span class="nc" id="L84"> return;</span>
}
<span class="fc" id="L87"> new CopyContracts(project, mavenSession, mavenResourcesFiltering)</span>
<span class="fc" id="L88"> .copy(contractsDirectory, outputDirectory);</span>
<span class="fc" id="L90"> final ContractVerifierConfigProperties config = new ContractVerifierConfigProperties();</span>
<span class="pc bpc" id="L91" title="1 of 2 branches missed."> config.setContractsDslDir(isInsideProject() ? contractsDirectory : source);</span>
<span class="fc" id="L92"> config.setStubsOutputDir(</span>
<span class="pc bpc" id="L93" title="1 of 2 branches missed."> isInsideProject() ? new File(outputDirectory, &quot;mappings&quot;) : destination);</span>
<span class="fc" id="L95"> getLog().info(</span>
&quot;Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings&quot;);
<span class="fc" id="L97"> getLog().info(String.format(</span>
&quot; Spring Cloud Contract Verifier contracts directory: %s&quot;,
<span class="fc" id="L99"> config.getContractsDslDir()));</span>
<span class="fc" id="L100"> getLog().info(String.format(&quot;WireMock stubs mappings directory: %s&quot;,</span>
<span class="fc" id="L101"> config.getStubsOutputDir()));</span>
<span class="fc" id="L103"> RecursiveFilesConverter converter = new RecursiveFilesConverter(</span>
new DslToWireMockClientConverter(), config);
<span class="fc" id="L105"> converter.processFiles();</span>
<span class="fc" id="L106"> }</span>
private boolean isInsideProject() {
<span class="fc" id="L109"> return mavenSession.getRequest().isProjectPresent();</span>
}
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>CopyContracts</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_class">CopyContracts</span></div><h1>CopyContracts</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">8 of 80</td><td class="ctr2">90%</td><td class="bar">0 of 0</td><td class="ctr2">n/a</td><td class="ctr1">0</td><td class="ctr2">3</td><td class="ctr1">2</td><td class="ctr2">25</td><td class="ctr1">0</td><td class="ctr2">3</td></tr></tfoot><tbody><tr><td id="a0"><a href="CopyContracts.java.html#L48" class="el_method">copy(File, File)</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="15" height="10" title="8" alt="8"/><img src="../.resources/greenbar.gif" width="104" height="10" title="55" alt="55"/></td><td class="ctr2" id="c2">87%</td><td class="bar" id="d0"/><td class="ctr2" id="e0">n/a</td><td class="ctr1" id="f0">0</td><td class="ctr2" id="g0">1</td><td class="ctr1" id="h0">2</td><td class="ctr2" id="i0">18</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a1"><a href="CopyContracts.java.html#L40" class="el_method">CopyContracts(MavenProject, MavenSession, MavenResourcesFiltering)</a></td><td class="bar" id="b1"><img src="../.resources/greenbar.gif" width="22" height="10" title="12" alt="12"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d1"/><td class="ctr2" id="e1">n/a</td><td class="ctr1" id="f1">0</td><td class="ctr2" id="g1">1</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i1">5</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a2"><a href="CopyContracts.java.html#L33" class="el_method">static {...}</a></td><td class="bar" id="b2"><img src="../.resources/greenbar.gif" width="9" height="10" title="5" alt="5"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i2">2</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>CopyContracts.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.source.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_source">CopyContracts.java</span></div><h1>CopyContracts.java</h1><pre class="source lang-java linenums">/*
* Copyright 2013-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.contract.maven.verifier;
import java.io.File;
import java.lang.invoke.MethodHandles;
import java.util.Collections;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.filtering.MavenFilteringException;
import org.apache.maven.shared.filtering.MavenResourcesExecution;
import org.apache.maven.shared.filtering.MavenResourcesFiltering;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CopyContracts {
<span class="fc" id="L33"> private static final Logger log = LoggerFactory</span>
<span class="fc" id="L34"> .getLogger(MethodHandles.lookup().lookupClass());</span>
private final MavenProject project;
private final MavenSession mavenSession;
private final MavenResourcesFiltering mavenResourcesFiltering;
public CopyContracts(MavenProject project, MavenSession mavenSession,
<span class="fc" id="L40"> MavenResourcesFiltering mavenResourcesFiltering) {</span>
<span class="fc" id="L41"> this.project = project;</span>
<span class="fc" id="L42"> this.mavenSession = mavenSession;</span>
<span class="fc" id="L43"> this.mavenResourcesFiltering = mavenResourcesFiltering;</span>
<span class="fc" id="L44"> }</span>
public void copy(File contractsDirectory, File outputDirectory)
throws MojoExecutionException {
<span class="fc" id="L48"> log.info(&quot;Copying Spring Cloud Contract Verifier contracts&quot;);</span>
<span class="fc" id="L49"> Resource resource = new Resource();</span>
<span class="fc" id="L50"> resource.setDirectory(contractsDirectory.getAbsolutePath());</span>
<span class="fc" id="L51"> MavenResourcesExecution execution = new MavenResourcesExecution();</span>
<span class="fc" id="L52"> execution.setResources(Collections.singletonList(resource));</span>
<span class="fc" id="L53"> execution.setOutputDirectory(new File(outputDirectory, &quot;contracts&quot;));</span>
<span class="fc" id="L54"> execution.setMavenProject(project);</span>
<span class="fc" id="L55"> execution.setEncoding(&quot;UTF-8&quot;);</span>
<span class="fc" id="L56"> execution.setMavenSession(mavenSession);</span>
<span class="fc" id="L57"> execution.setInjectProjectBuildFilters(false);</span>
<span class="fc" id="L58"> execution.setOverwrite(true);</span>
<span class="fc" id="L59"> execution.setIncludeEmptyDirs(false);</span>
<span class="fc" id="L60"> execution.setFilterFilenames(false);</span>
try {
<span class="fc" id="L62"> mavenResourcesFiltering.filterResources(execution);</span>
}
<span class="nc" id="L64"> catch (MavenFilteringException e) {</span>
<span class="nc" id="L65"> throw new MojoExecutionException(e.getMessage(), e);</span>
<span class="fc" id="L66"> }</span>
<span class="fc" id="L68"> }</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>GenerateStubsMojo</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_class">GenerateStubsMojo</span></div><h1>GenerateStubsMojo</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">45 of 153</td><td class="ctr2">71%</td><td class="bar">2 of 6</td><td class="ctr2">67%</td><td class="ctr1">2</td><td class="ctr2">6</td><td class="ctr1">6</td><td class="ctr2">25</td><td class="ctr1">0</td><td class="ctr2">3</td></tr></tfoot><tbody><tr><td id="a0"><a href="GenerateStubsMojo.java.html#L81" class="el_method">createStubJar(File)</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="32" height="10" title="32" alt="32"/><img src="../.resources/greenbar.gif" width="87" height="10" title="87" alt="87"/></td><td class="ctr2" id="c1">73%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="30" height="10" title="1" alt="1"/><img src="../.resources/greenbar.gif" width="90" height="10" title="3" alt="3"/></td><td class="ctr2" id="e0">75%</td><td class="ctr1" id="f0">1</td><td class="ctr2" id="g0">3</td><td class="ctr1" id="h0">4</td><td class="ctr2" id="i0">18</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a1"><a href="GenerateStubsMojo.java.html#L69" class="el_method">execute()</a></td><td class="bar" id="b1"><img src="../.resources/redbar.gif" width="13" height="10" title="13" alt="13"/><img src="../.resources/greenbar.gif" width="18" height="10" title="18" alt="18"/></td><td class="ctr2" id="c2">58%</td><td class="bar" id="d1"><img src="../.resources/redbar.gif" width="30" height="10" title="1" alt="1"/><img src="../.resources/greenbar.gif" width="30" height="10" title="1" alt="1"/></td><td class="ctr2" id="e1">50%</td><td class="ctr1" id="f1">1</td><td class="ctr2" id="g1">2</td><td class="ctr1" id="h1">2</td><td class="ctr2" id="i1">6</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a2"><a href="GenerateStubsMojo.java.html#L34" class="el_method">GenerateStubsMojo()</a></td><td class="bar" id="b2"><img src="../.resources/greenbar.gif" width="3" height="10" title="3" alt="3"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i2">1</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>GenerateStubsMojo.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.source.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_source">GenerateStubsMojo.java</span></div><h1>GenerateStubsMojo.java</h1><pre class="source lang-java linenums">/*
* Copyright 2013-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.contract.maven.verifier;
import java.io.File;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.archiver.Archiver;
import org.codehaus.plexus.archiver.jar.JarArchiver;
@Mojo(name = &quot;generateStubs&quot;, defaultPhase = LifecyclePhase.PACKAGE,
requiresProject = true)
<span class="fc" id="L34">public class GenerateStubsMojo extends AbstractMojo {</span>
private static final String STUB_MAPPING_FILE_PATTERN = &quot;**/*.json&quot;;
private static final String CONTRACT_FILE_PATTERN = &quot;**/*.groovy&quot;;
@Parameter(defaultValue = &quot;${project.build.directory}&quot;, readonly = true,
required = true)
private File projectBuildDirectory;
@Parameter(property = &quot;stubsDirectory&quot;,
defaultValue = &quot;${project.build.directory}/stubs&quot;)
private File outputDirectory;
/**
* Set this to &quot;true&quot; to bypass Verifier execution..
*/
@Parameter(property = &quot;spring.cloud.contract.verifier.skip&quot;, defaultValue = &quot;false&quot;)
private boolean skip;
@Component
private MavenProjectHelper projectHelper;
@Parameter(defaultValue = &quot;${project}&quot;, readonly = true)
private MavenProject project;
@Component(role = Archiver.class, hint = &quot;jar&quot;)
private JarArchiver archiver;
@Parameter(defaultValue = &quot;true&quot;)
private boolean attachContracts;
@Parameter(defaultValue = &quot;stubs&quot;)
private String classifier;
public void execute() throws MojoExecutionException, MojoFailureException {
<span class="pc bpc" id="L69" title="1 of 2 branches missed."> if (skip) {</span>
<span class="nc" id="L70"> getLog().info(</span>
&quot;Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip=&quot;
+ skip);
<span class="nc" id="L73"> return;</span>
}
<span class="fc" id="L75"> File stubsJarFile = createStubJar(outputDirectory);</span>
<span class="fc" id="L76"> projectHelper.attachArtifact(project, &quot;jar&quot;, classifier, stubsJarFile);</span>
<span class="fc" id="L77"> }</span>
private File createStubJar(File stubsOutputDir)
throws MojoFailureException, MojoExecutionException {
<span class="pc bpc" id="L81" title="1 of 2 branches missed."> if (!stubsOutputDir.exists()) {</span>
<span class="nc" id="L82"> throw new MojoExecutionException(</span>
<span class="nc" id="L83"> &quot;Stubs could not be found: [&quot; + stubsOutputDir.getAbsolutePath()</span>
+ &quot;] .\nPlease make sure that spring-cloud-contract:convert was invoked&quot;);
}
<span class="fc" id="L86"> String stubArchiveName =</span>
<span class="fc" id="L87"> project.getBuild().getFinalName() + &quot;-&quot; + classifier + &quot;.jar&quot;;</span>
<span class="fc" id="L88"> File stubsJarFile = new File(projectBuildDirectory, stubArchiveName);</span>
try {
<span class="fc bfc" id="L90" title="All 2 branches covered."> if (attachContracts) {</span>
<span class="fc" id="L91"> archiver.addDirectory(stubsOutputDir,</span>
new String[] { STUB_MAPPING_FILE_PATTERN, CONTRACT_FILE_PATTERN },
new String[0]);
}
else {
<span class="fc" id="L96"> getLog().info(</span>
&quot;Skipping attaching Spring Cloud Contract Verifier contracts&quot;);
<span class="fc" id="L98"> archiver.addDirectory(stubsOutputDir,</span>
new String[] { STUB_MAPPING_FILE_PATTERN },
new String[] { CONTRACT_FILE_PATTERN });
}
<span class="fc" id="L102"> archiver.setCompress(true);</span>
<span class="fc" id="L103"> archiver.setDestFile(stubsJarFile);</span>
<span class="fc" id="L104"> archiver.addConfiguredManifest(ManifestCreator.createManifest(project));</span>
<span class="fc" id="L105"> archiver.createArchive();</span>
}
<span class="nc" id="L107"> catch (Exception e) {</span>
<span class="nc" id="L108"> throw new MojoFailureException(</span>
&quot;Exception while packaging &quot; + classifier + &quot; jar.&quot;, e);
<span class="fc" id="L110"> }</span>
<span class="fc" id="L111"> return stubsJarFile;</span>
}
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

View File

@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>GenerateTestsMojo.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.source.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_source">GenerateTestsMojo.java</span></div><h1>GenerateTestsMojo.java</h1><pre class="source lang-java linenums">/*
* Copyright 2013-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.contract.maven.verifier;
import java.io.File;
import java.util.List;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.springframework.cloud.contract.spec.ContractVerifierException;
import org.springframework.cloud.contract.verifier.TestGenerator;
import org.springframework.cloud.contract.verifier.config.ContractVerifierConfigProperties;
import org.springframework.cloud.contract.verifier.config.TestFramework;
import org.springframework.cloud.contract.verifier.config.TestMode;
@Mojo(name = &quot;generateTests&quot;, defaultPhase = LifecyclePhase.GENERATE_TEST_SOURCES,
requiresDependencyResolution = ResolutionScope.TEST)
<span class="fc" id="L37">public class GenerateTestsMojo extends AbstractMojo {</span>
@Parameter(property = &quot;spring.cloud.contract.verifier.contractsDirectory&quot;,
defaultValue = &quot;${project.basedir}/src/test/resources/contracts&quot;)
private File contractsDirectory;
@Parameter(
defaultValue = &quot;${project.build.directory}/generated-test-sources/contracts&quot;)
private File generatedTestSourcesDir;
@Parameter(defaultValue = &quot;org.springframework.cloud.contract.verifier.tests&quot;)
private String basePackageForTests;
@Parameter
private String baseClassForTests;
@Parameter(defaultValue = &quot;MOCKMVC&quot;)
private TestMode testMode;
@Parameter(defaultValue = &quot;JUNIT&quot;)
private TestFramework testFramework;
@Parameter
private String ruleClassForTests;
@Parameter
private String nameSuffixForTests;
/**
* Imports that should be added to generated tests
*/
@Parameter
private String[] imports;
/**
* Static imports that should be added to generated tests
*/
@Parameter
private String[] staticImports;
/**
* Patterns that should not be taken into account for processing
*/
@Parameter
private List&lt;String&gt; excludedFiles;
/**
* Patterns for which Spring Cloud Contract Verifier should generate @Ignored tests
*/
@Parameter
private List&lt;String&gt; ignoredFiles;
@Parameter(defaultValue = &quot;${project}&quot;, readonly = true)
private MavenProject project;
@Parameter(property = &quot;spring.cloud.contract.verifier.skip&quot;, defaultValue = &quot;false&quot;)
private boolean skip;
@Parameter(property = &quot;maven.test.skip&quot;, defaultValue = &quot;false&quot;)
private boolean mavenTestSkip;
@Parameter(property = &quot;skipTests&quot;, defaultValue = &quot;false&quot;) private boolean skipTests;
public void execute() throws MojoExecutionException, MojoFailureException {
<span class="pc bpc" id="L101" title="3 of 6 branches missed."> if (skip || mavenTestSkip || skipTests) {</span>
<span class="nc bnc" id="L102" title="All 2 branches missed."> if (skip) getLog().info(&quot;Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip=&quot; + skip);</span>
<span class="nc bnc" id="L103" title="All 2 branches missed."> if (mavenTestSkip) getLog().info(&quot;Skipping Spring Cloud Contract Verifier execution: maven.test.skip=&quot; + mavenTestSkip);</span>
<span class="nc bnc" id="L104" title="All 2 branches missed."> if (skipTests) getLog().info(&quot;Skipping Spring Cloud Contract Verifier execution: skipTests&quot; + skipTests);</span>
<span class="nc" id="L105"> return;</span>
}
<span class="fc" id="L107"> getLog().info(</span>
&quot;Generating server tests source code for Spring Cloud Contract Verifier contract verification&quot;);
<span class="fc" id="L109"> final ContractVerifierConfigProperties config = new ContractVerifierConfigProperties();</span>
<span class="fc" id="L110"> config.setContractsDslDir(contractsDirectory);</span>
<span class="fc" id="L111"> config.setGeneratedTestSourcesDir(generatedTestSourcesDir);</span>
<span class="fc" id="L112"> config.setTargetFramework(testFramework);</span>
<span class="fc" id="L113"> config.setTestMode(testMode);</span>
<span class="fc" id="L114"> config.setBasePackageForTests(basePackageForTests);</span>
<span class="fc" id="L115"> config.setBaseClassForTests(baseClassForTests);</span>
<span class="fc" id="L116"> config.setRuleClassForTests(ruleClassForTests);</span>
<span class="fc" id="L117"> config.setNameSuffixForTests(nameSuffixForTests);</span>
<span class="fc" id="L118"> config.setImports(imports);</span>
<span class="fc" id="L119"> config.setStaticImports(staticImports);</span>
<span class="fc" id="L120"> config.setIgnoredFiles(ignoredFiles);</span>
<span class="fc" id="L121"> config.setExcludedFiles(excludedFiles);</span>
<span class="fc" id="L122"> project.addTestCompileSourceRoot(generatedTestSourcesDir.getAbsolutePath());</span>
<span class="pc bpc" id="L123" title="1 of 2 branches missed."> if (getLog().isInfoEnabled()) {</span>
<span class="fc" id="L124"> getLog().info(</span>
<span class="fc" id="L125"> &quot;Test Source directory: &quot; + generatedTestSourcesDir.getAbsolutePath()</span>
+ &quot; added.&quot;);
<span class="fc" id="L127"> getLog().info(&quot;Using &quot; + config.getBaseClassForTests()</span>
+ &quot; as base class for test classes&quot;);
}
try {
<span class="fc" id="L131"> TestGenerator generator = new TestGenerator(config);</span>
<span class="fc" id="L132"> int generatedClasses = generator.generate();</span>
<span class="fc" id="L133"> getLog().info(&quot;Generated &quot; + generatedClasses + &quot; test classes.&quot;);</span>
}
<span class="nc" id="L135"> catch (ContractVerifierException e) {</span>
<span class="nc" id="L136"> throw new MojoExecutionException(</span>
<span class="nc" id="L137"> String.format(&quot;Spring Cloud Contract Verifier Plugin exception: %s&quot;,</span>
<span class="nc" id="L138"> e.getMessage()), e);</span>
<span class="fc" id="L139"> }</span>
<span class="fc" id="L140"> }</span>
public List&lt;String&gt; getExcludedFiles() {
<span class="nc" id="L143"> return excludedFiles;</span>
}
public void setExcludedFiles(List&lt;String&gt; excludedFiles) {
<span class="nc" id="L147"> this.excludedFiles = excludedFiles;</span>
<span class="nc" id="L148"> }</span>
public List&lt;String&gt; getIgnoredFiles() {
<span class="nc" id="L151"> return ignoredFiles;</span>
}
public void setIgnoredFiles(List&lt;String&gt; ignoredFiles) {
<span class="nc" id="L155"> this.ignoredFiles = ignoredFiles;</span>
<span class="nc" id="L156"> }</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>ManifestCreator</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_class">ManifestCreator</span></div><h1>ManifestCreator</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">42 of 81</td><td class="ctr2">48%</td><td class="bar">9 of 12</td><td class="ctr2">25%</td><td class="ctr1">8</td><td class="ctr2">10</td><td class="ctr1">12</td><td class="ctr2">21</td><td class="ctr1">2</td><td class="ctr2">4</td></tr></tfoot><tbody><tr><td id="a2"><a href="ManifestCreator.java.html#L54" class="el_method">findVerifierDependency(List)</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="63" height="10" title="20" alt="20"/></td><td class="ctr2" id="c2">0%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="120" height="10" title="4" alt="4"/></td><td class="ctr2" id="e2">0%</td><td class="ctr1" id="f0">3</td><td class="ctr2" id="g0">3</td><td class="ctr1" id="h0">5</td><td class="ctr2" id="i1">5</td><td class="ctr1" id="j0">1</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a0"><a href="ManifestCreator.java.html#L29" class="el_method">createManifest(MavenProject)</a></td><td class="bar" id="b1"><img src="../.resources/redbar.gif" width="50" height="10" title="16" alt="16"/><img src="../.resources/greenbar.gif" width="69" height="10" title="22" alt="22"/></td><td class="ctr2" id="c1">58%</td><td class="bar" id="d1"><img src="../.resources/redbar.gif" width="90" height="10" title="3" alt="3"/><img src="../.resources/greenbar.gif" width="30" height="10" title="1" alt="1"/></td><td class="ctr2" id="e1">25%</td><td class="ctr1" id="f1">2</td><td class="ctr2" id="g1">3</td><td class="ctr1" id="h1">4</td><td class="ctr2" id="i0">10</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a1"><a href="ManifestCreator.java.html#L45" class="el_method">findMavenPlugin(List)</a></td><td class="bar" id="b2"><img src="../.resources/redbar.gif" width="9" height="10" title="3" alt="3"/><img src="../.resources/greenbar.gif" width="53" height="10" title="17" alt="17"/></td><td class="ctr2" id="c0">85%</td><td class="bar" id="d2"><img src="../.resources/redbar.gif" width="60" height="10" title="2" alt="2"/><img src="../.resources/greenbar.gif" width="60" height="10" title="2" alt="2"/></td><td class="ctr2" id="e0">50%</td><td class="ctr1" id="f2">2</td><td class="ctr2" id="g2">3</td><td class="ctr1" id="h2">2</td><td class="ctr2" id="i2">5</td><td class="ctr1" id="j3">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a3"><a href="ManifestCreator.java.html#L27" class="el_method">ManifestCreator()</a></td><td class="bar" id="b3"><img src="../.resources/redbar.gif" width="9" height="10" title="3" alt="3"/></td><td class="ctr2" id="c3">0%</td><td class="bar" id="d3"/><td class="ctr2" id="e3">n/a</td><td class="ctr1" id="f3">1</td><td class="ctr2" id="g3">1</td><td class="ctr1" id="h3">1</td><td class="ctr2" id="i3">1</td><td class="ctr1" id="j1">1</td><td class="ctr2" id="k3">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>ManifestCreator.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.source.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_source">ManifestCreator.java</span></div><h1>ManifestCreator.java</h1><pre class="source lang-java linenums">/*
* Copyright 2013-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.contract.maven.verifier;
import java.util.List;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Plugin;
import org.apache.maven.project.MavenProject;
import org.codehaus.groovy.runtime.DefaultGroovyMethods;
import org.codehaus.plexus.archiver.jar.Manifest;
import org.codehaus.plexus.archiver.jar.ManifestException;
<span class="nc" id="L27">public class ManifestCreator {</span>
public static Manifest createManifest(MavenProject project) throws ManifestException {
<span class="fc" id="L29"> Manifest manifest = new Manifest();</span>
<span class="fc" id="L30"> Plugin verifierMavenPlugin = findMavenPlugin(project.getBuildPlugins());</span>
<span class="fc" id="L31"> manifest.addConfiguredAttribute(new Manifest.Attribute(</span>
<span class="fc" id="L32"> &quot;Spring-Cloud-Contract-Verifier-Maven-Plugin-Version&quot;, verifierMavenPlugin.getVersion()));</span>
<span class="pc bpc" id="L33" title="1 of 2 branches missed."> if (DefaultGroovyMethods.asBoolean(verifierMavenPlugin.getDependencies())) {</span>
<span class="nc" id="L34"> Dependency verifierDependency = findVerifierDependency(verifierMavenPlugin.getDependencies());</span>
<span class="nc bnc" id="L35" title="All 2 branches missed."> if (verifierDependency != null) {</span>
<span class="nc" id="L36"> String verifierVersion = verifierDependency.getVersion();</span>
<span class="nc" id="L37"> manifest.addConfiguredAttribute(new Manifest.Attribute(&quot;Spring-Cloud-Contract-Verifier-Version&quot;,</span>
verifierVersion));
}
}
<span class="fc" id="L41"> return manifest;</span>
}
private static Plugin findMavenPlugin(List&lt;Plugin&gt; plugins) {
<span class="pc bpc" id="L45" title="1 of 2 branches missed."> for (Plugin plugin : plugins) {</span>
<span class="pc bpc" id="L46" title="1 of 2 branches missed."> if (&quot;spring-cloud-contract-maven-plugin&quot;.equals(plugin.getArtifactId())) {</span>
<span class="fc" id="L47"> return plugin;</span>
}
<span class="nc" id="L49"> }</span>
<span class="nc" id="L50"> return null;</span>
}
private static Dependency findVerifierDependency(List&lt;Dependency&gt; deps) {
<span class="nc bnc" id="L54" title="All 2 branches missed."> for (Dependency dep : deps) {</span>
<span class="nc bnc" id="L55" title="All 2 branches missed."> if (&quot;spring-cloud-contract-verifier&quot;.equals(dep.getArtifactId())) {</span>
<span class="nc" id="L56"> return dep;</span>
}
<span class="nc" id="L58"> }</span>
<span class="nc" id="L59"> return null;</span>
}
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>RunMojo</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_class">RunMojo</span></div><h1>RunMojo</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">131 of 131</td><td class="ctr2">0%</td><td class="bar">10 of 10</td><td class="ctr2">0%</td><td class="ctr1">10</td><td class="ctr2">10</td><td class="ctr1">39</td><td class="ctr2">39</td><td class="ctr1">5</td><td class="ctr2">5</td></tr></tfoot><tbody><tr><td id="a0"><a href="RunMojo.java.html#L99" class="el_method">execute()</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="120" height="10" title="95" alt="95"/></td><td class="ctr2" id="c0">0%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="120" height="10" title="8" alt="8"/></td><td class="ctr2" id="e0">0%</td><td class="ctr1" id="f0">5</td><td class="ctr2" id="g0">5</td><td class="ctr1" id="h0">25</td><td class="ctr2" id="i0">25</td><td class="ctr1" id="j0">1</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a4"><a href="RunMojo.java.html#L82" class="el_method">RunMojo(LocalStubRunner, RemoteStubRunner)</a></td><td class="bar" id="b1"><img src="../.resources/redbar.gif" width="15" height="10" title="12" alt="12"/></td><td class="ctr2" id="c1">0%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f2">1</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h1">5</td><td class="ctr2" id="i1">5</td><td class="ctr1" id="j1">1</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a2"><a href="RunMojo.java.html#L138" class="el_method">pressAnyKeyToContinue()</a></td><td class="bar" id="b2"><img src="../.resources/redbar.gif" width="12" height="10" title="10" alt="10"/></td><td class="ctr2" id="c2">0%</td><td class="bar" id="d3"/><td class="ctr2" id="e3">n/a</td><td class="ctr1" id="f3">1</td><td class="ctr2" id="g3">1</td><td class="ctr1" id="h2">5</td><td class="ctr2" id="i2">5</td><td class="ctr1" id="j2">1</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a3"><a href="RunMojo.java.html#L130" class="el_method">resolveStubsDirectory()</a></td><td class="bar" id="b3"><img src="../.resources/redbar.gif" width="11" height="10" title="9" alt="9"/></td><td class="ctr2" id="c3">0%</td><td class="bar" id="d1"><img src="../.resources/redbar.gif" width="30" height="10" title="2" alt="2"/></td><td class="ctr2" id="e1">0%</td><td class="ctr1" id="f1">2</td><td class="ctr2" id="g1">2</td><td class="ctr1" id="h3">3</td><td class="ctr2" id="i3">3</td><td class="ctr1" id="j3">1</td><td class="ctr2" id="k3">1</td></tr><tr><td id="a1"><a href="RunMojo.java.html#L146" class="el_method">isInsideProject()</a></td><td class="bar" id="b4"><img src="../.resources/redbar.gif" width="6" height="10" title="5" alt="5"/></td><td class="ctr2" id="c4">0%</td><td class="bar" id="d4"/><td class="ctr2" id="e4">n/a</td><td class="ctr1" id="f4">1</td><td class="ctr2" id="g4">1</td><td class="ctr1" id="h4">1</td><td class="ctr2" id="i4">1</td><td class="ctr1" id="j4">1</td><td class="ctr2" id="k4">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

View File

@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>RunMojo.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Spring Cloud Contract Maven Plugin</a> &gt; <a href="index.source.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> &gt; <span class="el_source">RunMojo.java</span></div><h1>RunMojo.java</h1><pre class="source lang-java linenums">/*
* Copyright 2013-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.contract.maven.verifier;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import javax.inject.Inject;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.eclipse.aether.RepositorySystemSession;
import org.springframework.cloud.contract.maven.verifier.stubrunner.LocalStubRunner;
import org.springframework.cloud.contract.maven.verifier.stubrunner.RemoteStubRunner;
import org.springframework.cloud.contract.stubrunner.BatchStubRunner;
import org.springframework.cloud.contract.stubrunner.StubRunner;
import org.springframework.cloud.contract.stubrunner.StubRunnerOptions;
import org.springframework.cloud.contract.stubrunner.StubRunnerOptionsBuilder;
import static com.google.common.base.Strings.isNullOrEmpty;
@Mojo(name = &quot;run&quot;, requiresProject = false, requiresDependencyResolution = ResolutionScope.RUNTIME)
public class RunMojo extends AbstractMojo {
@Parameter(defaultValue = &quot;${repositorySystemSession}&quot;, readonly = true)
private RepositorySystemSession repoSession;
@Parameter(defaultValue = &quot;${project.build.directory}/contracts/mappings&quot;)
private File stubsDirectory;
@Parameter(property = &quot;stubsDirectory&quot;, defaultValue = &quot;${basedir}&quot;)
private File destination;
/**
* HTTP port for WireMock server
*/
@Parameter(property = &quot;spring.cloud.contract.verifier.http.port&quot;, defaultValue = &quot;8080&quot;)
private int httpPort;
/**
* Set this to &quot;true&quot; to bypass verifier execution.
*/
@Parameter(property = &quot;spring.cloud.contract.verifier.skip&quot;, defaultValue = &quot;false&quot;)
private boolean skip;
/**
* Set this to &quot;true&quot; to bypass verifier test generation.
*/
@Parameter(property = &quot;spring.cloud.contract.verifier.skipTestOnly&quot;, defaultValue = &quot;false&quot;)
private boolean skipTestOnly;
@Parameter(property = &quot;spring.cloud.contract.verifier.stubs&quot;)
private String stubs;
@Parameter(property = &quot;spring.cloud.contract.verifier.http.minPort&quot;, defaultValue = &quot;10000&quot;)
private int minPort;
@Parameter(property = &quot;spring.cloud.contract.verifier.http.maxPort&quot;, defaultValue = &quot;15000&quot;)
private int maxPort;
/**
* Classifier used by stubs artifacts.
*/
<span class="nc" id="L82"> @Parameter(defaultValue = &quot;stubs&quot;)</span>
private String stubsClassifier = &quot;stubs&quot;;
@Parameter(defaultValue = &quot;${session}&quot;, readonly = true)
private MavenSession mavenSession;
private final LocalStubRunner localStubRunner;
private final RemoteStubRunner remoteStubRunner;
@Inject
<span class="nc" id="L93"> public RunMojo(LocalStubRunner localStubRunner, RemoteStubRunner remoteStubRunner) {</span>
<span class="nc" id="L94"> this.localStubRunner = localStubRunner;</span>
<span class="nc" id="L95"> this.remoteStubRunner = remoteStubRunner;</span>
<span class="nc" id="L96"> }</span>
public void execute() throws MojoExecutionException, MojoFailureException {
<span class="nc bnc" id="L99" title="All 4 branches missed."> if (skip || skipTestOnly) {</span>
<span class="nc" id="L100"> getLog().info(&quot;Skipping verifier execution: spring.cloud.contract.verifier.skip=&quot; + String.valueOf(skip));</span>
<span class="nc" id="L101"> return;</span>
}
<span class="nc" id="L103"> BatchStubRunner batchStubRunner = null;</span>
<span class="nc" id="L104"> StubRunnerOptionsBuilder optionsBuilder = new StubRunnerOptionsBuilder()</span>
<span class="nc" id="L105"> .withStubsClassifier(stubsClassifier);</span>
<span class="nc bnc" id="L106" title="All 2 branches missed."> if (isNullOrEmpty(stubs)) {</span>
<span class="nc" id="L107"> StubRunnerOptions options = optionsBuilder</span>
<span class="nc" id="L108"> .withPort(httpPort)</span>
<span class="nc" id="L109"> .build();</span>
<span class="nc" id="L110"> StubRunner stubRunner = localStubRunner.run(resolveStubsDirectory().getAbsolutePath(), options);</span>
<span class="nc" id="L111"> batchStubRunner = new BatchStubRunner(Collections.singleton(stubRunner));</span>
<span class="nc" id="L112"> } else {</span>
<span class="nc" id="L113"> StubRunnerOptions options = optionsBuilder</span>
<span class="nc" id="L114"> .withStubs(stubs)</span>
<span class="nc" id="L115"> .withMinMaxPort(minPort, maxPort)</span>
<span class="nc" id="L116"> .build();</span>
<span class="nc" id="L117"> batchStubRunner = remoteStubRunner.run(options, repoSession);</span>
}
<span class="nc" id="L119"> pressAnyKeyToContinue();</span>
<span class="nc bnc" id="L120" title="All 2 branches missed."> if (batchStubRunner != null) {</span>
try {
<span class="nc" id="L122"> batchStubRunner.close();</span>
<span class="nc" id="L123"> } catch (IOException e) {</span>
<span class="nc" id="L124"> throw new MojoExecutionException(&quot;Fail to close batch stub runner&quot;, e);</span>
<span class="nc" id="L125"> }</span>
}
<span class="nc" id="L127"> }</span>
private File resolveStubsDirectory() {
<span class="nc bnc" id="L130" title="All 2 branches missed."> if (isInsideProject()) {</span>
<span class="nc" id="L131"> return stubsDirectory;</span>
} else {
<span class="nc" id="L133"> return destination;</span>
}
}
private void pressAnyKeyToContinue() {
<span class="nc" id="L138"> getLog().info(&quot;Press ENTER to continue...&quot;);</span>
try {
<span class="nc" id="L140"> System.in.read();</span>
<span class="nc" id="L141"> } catch (Exception ignored) {</span>
<span class="nc" id="L142"> }</span>
<span class="nc" id="L143"> }</span>
private boolean isInsideProject() {
<span class="nc" id="L146"> return mavenSession.getRequest().isProjectPresent();</span>
}
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>

File diff suppressed because one or more lines are too long