This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # Fixed URLs ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * [ ] http://www.apache.org/licenses/ with 16 occurrences migrated to: https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200). * [ ] http://www.apache.org/licenses/LICENSE-2.0 with 311 occurrences migrated to: https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200). * [ ] http://www.apache.org/licenses/LICENSE-2.0.html with 7 occurrences migrated to: https://www.apache.org/licenses/LICENSE-2.0.html ([https](https://www.apache.org/licenses/LICENSE-2.0.html) result 200). * [ ] http://www.apache.org/licenses/LICENSE-2.0.txt with 424 occurrences migrated to: https://www.apache.org/licenses/LICENSE-2.0.txt ([https](https://www.apache.org/licenses/LICENSE-2.0.txt) result 200).
113 lines
6.4 KiB
HTML
113 lines
6.4 KiB
HTML
<?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> > <a href="index.source.html" class="el_package">org.springframework.cloud.contract.maven.verifier</a> > <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 "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* https://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 "AS IS" 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.
|
|
* <p>
|
|
* This goal allows you to generate `stubs-jar` or execute `spring-cloud-contract:run` with generated WireMock mappings.
|
|
*/
|
|
@Mojo(name = "convert", 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 = "${basedir}/src/test/resources/contracts")
|
|
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 = "${project.build.directory}/stubs")
|
|
private File outputDirectory;
|
|
|
|
/**
|
|
* Directory containing contracts written using the GroovyDSL
|
|
* <p>
|
|
* This parameter is only used when goal is executed outside of maven project.
|
|
*/
|
|
@Parameter(property = "contractsDirectory", defaultValue = "${basedir}")
|
|
private File source;
|
|
|
|
@Parameter(property = "stubsDirectory", defaultValue = "${basedir}")
|
|
private File destination;
|
|
|
|
@Parameter(property = "spring.cloud.contract.verifier.skip", defaultValue = "false")
|
|
private boolean skip;
|
|
|
|
@Parameter(defaultValue = "${session}", readonly = true)
|
|
private MavenSession mavenSession;
|
|
|
|
@Parameter(defaultValue = "${project}", readonly = true) private MavenProject project;
|
|
|
|
@Component(role = MavenResourcesFiltering.class, hint = "default")
|
|
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>
|
|
"Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip=%s",
|
|
<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, "mappings") : destination);</span>
|
|
|
|
<span class="fc" id="L95"> getLog().info(</span>
|
|
"Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings");
|
|
<span class="fc" id="L97"> getLog().info(String.format(</span>
|
|
" Spring Cloud Contract Verifier contracts directory: %s",
|
|
<span class="fc" id="L99"> config.getContractsDslDir()));</span>
|
|
<span class="fc" id="L100"> getLog().info(String.format("WireMock stubs mappings directory: %s",</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> |