Applied checkstyle rules
This commit is contained in:
@@ -4,7 +4,7 @@ public class Tweet {
|
||||
private String text;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class FraudCheck {
|
||||
}
|
||||
|
||||
public String getClientPesel() {
|
||||
return clientPesel;
|
||||
return this.clientPesel;
|
||||
}
|
||||
|
||||
public void setClientPesel(String clientPesel) {
|
||||
@@ -20,7 +20,7 @@ public class FraudCheck {
|
||||
}
|
||||
|
||||
public BigDecimal getLoanAmount() {
|
||||
return loanAmount;
|
||||
return this.loanAmount;
|
||||
}
|
||||
|
||||
public void setLoanAmount(BigDecimal loanAmount) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public class FraudCheckResult {
|
||||
}
|
||||
|
||||
public FraudCheckStatus getFraudCheckStatus() {
|
||||
return fraudCheckStatus;
|
||||
return this.fraudCheckStatus;
|
||||
}
|
||||
|
||||
public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) {
|
||||
@@ -23,7 +23,7 @@ public class FraudCheckResult {
|
||||
}
|
||||
|
||||
public String getRejectionReason() {
|
||||
return rejectionReason;
|
||||
return this.rejectionReason;
|
||||
}
|
||||
|
||||
public void setRejectionReason(String rejectionReason) {
|
||||
|
||||
@@ -59,7 +59,7 @@ public class LoanApplicationService {
|
||||
httpHeaders.add(HttpHeaders.CONTENT_TYPE, FRAUD_SERVICE_JSON_VERSION_1);
|
||||
|
||||
ResponseEntity<FraudServiceResponse> response =
|
||||
restTemplate.exchange("http://localhost:" + port + "/fraudcheck", HttpMethod.PUT,
|
||||
this.restTemplate.exchange("http://localhost:" + this.port + "/fraudcheck", HttpMethod.PUT,
|
||||
new HttpEntity<>(request, httpHeaders),
|
||||
FraudServiceResponse.class);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Client {
|
||||
private String pesel;
|
||||
|
||||
public String getPesel() {
|
||||
return pesel;
|
||||
return this.pesel;
|
||||
}
|
||||
|
||||
public void setPesel(String pesel) {
|
||||
|
||||
@@ -33,7 +33,7 @@ public class FraudServiceRequest {
|
||||
}
|
||||
|
||||
public String getClientPesel() {
|
||||
return clientPesel;
|
||||
return this.clientPesel;
|
||||
}
|
||||
|
||||
public void setClientPesel(String clientPesel) {
|
||||
@@ -41,7 +41,7 @@ public class FraudServiceRequest {
|
||||
}
|
||||
|
||||
public BigDecimal getLoanAmount() {
|
||||
return loanAmount;
|
||||
return this.loanAmount;
|
||||
}
|
||||
|
||||
public void setLoanAmount(BigDecimal loanAmount) {
|
||||
|
||||
@@ -26,7 +26,7 @@ public class FraudServiceResponse {
|
||||
}
|
||||
|
||||
public FraudCheckStatus getFraudCheckStatus() {
|
||||
return fraudCheckStatus;
|
||||
return this.fraudCheckStatus;
|
||||
}
|
||||
|
||||
public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) {
|
||||
@@ -34,7 +34,7 @@ public class FraudServiceResponse {
|
||||
}
|
||||
|
||||
public String getRejectionReason() {
|
||||
return rejectionReason;
|
||||
return this.rejectionReason;
|
||||
}
|
||||
|
||||
public void setRejectionReason(String rejectionReason) {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class LoanApplication {
|
||||
private String loanApplicationId;
|
||||
|
||||
public Client getClient() {
|
||||
return client;
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public void setClient(Client client) {
|
||||
@@ -35,7 +35,7 @@ public class LoanApplication {
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
@@ -43,7 +43,7 @@ public class LoanApplication {
|
||||
}
|
||||
|
||||
public String getLoanApplicationId() {
|
||||
return loanApplicationId;
|
||||
return this.loanApplicationId;
|
||||
}
|
||||
|
||||
public void setLoanApplicationId(String loanApplicationId) {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class LoanApplicationResult {
|
||||
}
|
||||
|
||||
public LoanApplicationStatus getLoanApplicationStatus() {
|
||||
return loanApplicationStatus;
|
||||
return this.loanApplicationStatus;
|
||||
}
|
||||
|
||||
public void setLoanApplicationStatus(LoanApplicationStatus loanApplicationStatus) {
|
||||
@@ -39,7 +39,7 @@ public class LoanApplicationResult {
|
||||
}
|
||||
|
||||
public String getRejectionReason() {
|
||||
return rejectionReason;
|
||||
return this.rejectionReason;
|
||||
}
|
||||
|
||||
public void setRejectionReason(String rejectionReason) {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class FraudCheck {
|
||||
}
|
||||
|
||||
public String getClientPesel() {
|
||||
return clientPesel;
|
||||
return this.clientPesel;
|
||||
}
|
||||
|
||||
public void setClientPesel(String clientPesel) {
|
||||
@@ -20,7 +20,7 @@ public class FraudCheck {
|
||||
}
|
||||
|
||||
public BigDecimal getLoanAmount() {
|
||||
return loanAmount;
|
||||
return this.loanAmount;
|
||||
}
|
||||
|
||||
public void setLoanAmount(BigDecimal loanAmount) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public class FraudCheckResult {
|
||||
}
|
||||
|
||||
public FraudCheckStatus getFraudCheckStatus() {
|
||||
return fraudCheckStatus;
|
||||
return this.fraudCheckStatus;
|
||||
}
|
||||
|
||||
public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) {
|
||||
@@ -23,7 +23,7 @@ public class FraudCheckResult {
|
||||
}
|
||||
|
||||
public String getRejectionReason() {
|
||||
return rejectionReason;
|
||||
return this.rejectionReason;
|
||||
}
|
||||
|
||||
public void setRejectionReason(String rejectionReason) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class LoanApplicationService {
|
||||
httpHeaders.add(HttpHeaders.CONTENT_TYPE, FRAUD_SERVICE_JSON_VERSION_1);
|
||||
|
||||
ResponseEntity<FraudServiceResponse> response =
|
||||
restTemplate.exchange("http://localhost:" + port + "/fraudcheck", HttpMethod.PUT,
|
||||
this.restTemplate.exchange("http://localhost:" + this.port + "/fraudcheck", HttpMethod.PUT,
|
||||
new HttpEntity<>(request, httpHeaders),
|
||||
FraudServiceResponse.class);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ public class Client {
|
||||
private String pesel;
|
||||
|
||||
public String getPesel() {
|
||||
return pesel;
|
||||
return this.pesel;
|
||||
}
|
||||
|
||||
public void setPesel(String pesel) {
|
||||
|
||||
@@ -17,7 +17,7 @@ public class FraudServiceRequest {
|
||||
}
|
||||
|
||||
public String getClientPesel() {
|
||||
return clientPesel;
|
||||
return this.clientPesel;
|
||||
}
|
||||
|
||||
public void setClientPesel(String clientPesel) {
|
||||
@@ -25,7 +25,7 @@ public class FraudServiceRequest {
|
||||
}
|
||||
|
||||
public BigDecimal getLoanAmount() {
|
||||
return loanAmount;
|
||||
return this.loanAmount;
|
||||
}
|
||||
|
||||
public void setLoanAmount(BigDecimal loanAmount) {
|
||||
|
||||
@@ -10,7 +10,7 @@ public class FraudServiceResponse {
|
||||
}
|
||||
|
||||
public FraudCheckStatus getFraudCheckStatus() {
|
||||
return fraudCheckStatus;
|
||||
return this.fraudCheckStatus;
|
||||
}
|
||||
|
||||
public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) {
|
||||
@@ -18,7 +18,7 @@ public class FraudServiceResponse {
|
||||
}
|
||||
|
||||
public String getRejectionReason() {
|
||||
return rejectionReason;
|
||||
return this.rejectionReason;
|
||||
}
|
||||
|
||||
public void setRejectionReason(String rejectionReason) {
|
||||
|
||||
@@ -11,7 +11,7 @@ public class LoanApplication {
|
||||
private String loanApplicationId;
|
||||
|
||||
public Client getClient() {
|
||||
return client;
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public void setClient(Client client) {
|
||||
@@ -19,7 +19,7 @@ public class LoanApplication {
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
@@ -27,7 +27,7 @@ public class LoanApplication {
|
||||
}
|
||||
|
||||
public String getLoanApplicationId() {
|
||||
return loanApplicationId;
|
||||
return this.loanApplicationId;
|
||||
}
|
||||
|
||||
public void setLoanApplicationId(String loanApplicationId) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public class LoanApplicationResult {
|
||||
}
|
||||
|
||||
public LoanApplicationStatus getLoanApplicationStatus() {
|
||||
return loanApplicationStatus;
|
||||
return this.loanApplicationStatus;
|
||||
}
|
||||
|
||||
public void setLoanApplicationStatus(LoanApplicationStatus loanApplicationStatus) {
|
||||
@@ -23,7 +23,7 @@ public class LoanApplicationResult {
|
||||
}
|
||||
|
||||
public String getRejectionReason() {
|
||||
return rejectionReason;
|
||||
return this.rejectionReason;
|
||||
}
|
||||
|
||||
public void setRejectionReason(String rejectionReason) {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class FraudCheck {
|
||||
}
|
||||
|
||||
public String getClientPesel() {
|
||||
return clientPesel;
|
||||
return this.clientPesel;
|
||||
}
|
||||
|
||||
public void setClientPesel(String clientPesel) {
|
||||
@@ -20,7 +20,7 @@ public class FraudCheck {
|
||||
}
|
||||
|
||||
public BigDecimal getLoanAmount() {
|
||||
return loanAmount;
|
||||
return this.loanAmount;
|
||||
}
|
||||
|
||||
public void setLoanAmount(BigDecimal loanAmount) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public class FraudCheckResult {
|
||||
}
|
||||
|
||||
public FraudCheckStatus getFraudCheckStatus() {
|
||||
return fraudCheckStatus;
|
||||
return this.fraudCheckStatus;
|
||||
}
|
||||
|
||||
public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) {
|
||||
@@ -23,7 +23,7 @@ public class FraudCheckResult {
|
||||
}
|
||||
|
||||
public String getRejectionReason() {
|
||||
return rejectionReason;
|
||||
return this.rejectionReason;
|
||||
}
|
||||
|
||||
public void setRejectionReason(String rejectionReason) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class LoanApplicationService {
|
||||
httpHeaders.add(HttpHeaders.CONTENT_TYPE, FRAUD_SERVICE_JSON_VERSION_1);
|
||||
|
||||
ResponseEntity<FraudServiceResponse> response =
|
||||
restTemplate.exchange("http://localhost:" + port + "/fraudcheck", HttpMethod.PUT,
|
||||
this.restTemplate.exchange("http://localhost:" + this.port + "/fraudcheck", HttpMethod.PUT,
|
||||
new HttpEntity<>(request, httpHeaders),
|
||||
FraudServiceResponse.class);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ public class Client {
|
||||
private String pesel;
|
||||
|
||||
public String getPesel() {
|
||||
return pesel;
|
||||
return this.pesel;
|
||||
}
|
||||
|
||||
public void setPesel(String pesel) {
|
||||
|
||||
@@ -17,7 +17,7 @@ public class FraudServiceRequest {
|
||||
}
|
||||
|
||||
public String getClientPesel() {
|
||||
return clientPesel;
|
||||
return this.clientPesel;
|
||||
}
|
||||
|
||||
public void setClientPesel(String clientPesel) {
|
||||
@@ -25,7 +25,7 @@ public class FraudServiceRequest {
|
||||
}
|
||||
|
||||
public BigDecimal getLoanAmount() {
|
||||
return loanAmount;
|
||||
return this.loanAmount;
|
||||
}
|
||||
|
||||
public void setLoanAmount(BigDecimal loanAmount) {
|
||||
|
||||
@@ -10,7 +10,7 @@ public class FraudServiceResponse {
|
||||
}
|
||||
|
||||
public FraudCheckStatus getFraudCheckStatus() {
|
||||
return fraudCheckStatus;
|
||||
return this.fraudCheckStatus;
|
||||
}
|
||||
|
||||
public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) {
|
||||
@@ -18,7 +18,7 @@ public class FraudServiceResponse {
|
||||
}
|
||||
|
||||
public String getRejectionReason() {
|
||||
return rejectionReason;
|
||||
return this.rejectionReason;
|
||||
}
|
||||
|
||||
public void setRejectionReason(String rejectionReason) {
|
||||
|
||||
@@ -11,7 +11,7 @@ public class LoanApplication {
|
||||
private String loanApplicationId;
|
||||
|
||||
public Client getClient() {
|
||||
return client;
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public void setClient(Client client) {
|
||||
@@ -19,7 +19,7 @@ public class LoanApplication {
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
@@ -27,7 +27,7 @@ public class LoanApplication {
|
||||
}
|
||||
|
||||
public String getLoanApplicationId() {
|
||||
return loanApplicationId;
|
||||
return this.loanApplicationId;
|
||||
}
|
||||
|
||||
public void setLoanApplicationId(String loanApplicationId) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public class LoanApplicationResult {
|
||||
}
|
||||
|
||||
public LoanApplicationStatus getLoanApplicationStatus() {
|
||||
return loanApplicationStatus;
|
||||
return this.loanApplicationStatus;
|
||||
}
|
||||
|
||||
public void setLoanApplicationStatus(LoanApplicationStatus loanApplicationStatus) {
|
||||
@@ -23,7 +23,7 @@ public class LoanApplicationResult {
|
||||
}
|
||||
|
||||
public String getRejectionReason() {
|
||||
return rejectionReason;
|
||||
return this.rejectionReason;
|
||||
}
|
||||
|
||||
public void setRejectionReason(String rejectionReason) {
|
||||
|
||||
@@ -197,6 +197,39 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>${checkstyle.version}</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build-tools</artifactId>
|
||||
<version>${spring-cloud-build.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>validate</id>
|
||||
<phase>validate</phase>
|
||||
<configuration>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
<headerLocation>LICENSE.txt</headerLocation>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<failsOnError>true</failsOnError>
|
||||
<sourceDirectories>
|
||||
${project.basedir}/src/main/java,${project.basedir}/src/main/groovy
|
||||
</sourceDirectories>
|
||||
<testSourceDirectories>
|
||||
${project.basedir}/src/test/java,${project.basedir}/src/test/groovy
|
||||
</testSourceDirectories>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -77,20 +77,20 @@ public class ConvertMojo extends AbstractMojo {
|
||||
|
||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||
|
||||
if (skip) {
|
||||
if (this.skip) {
|
||||
getLog().info(String.format(
|
||||
"Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip=%s",
|
||||
skip));
|
||||
this.skip));
|
||||
return;
|
||||
}
|
||||
|
||||
new CopyContracts(project, mavenSession, mavenResourcesFiltering)
|
||||
.copy(contractsDirectory, outputDirectory);
|
||||
new CopyContracts(this.project, this.mavenSession, this.mavenResourcesFiltering)
|
||||
.copy(this.contractsDirectory, this.outputDirectory);
|
||||
|
||||
final ContractVerifierConfigProperties config = new ContractVerifierConfigProperties();
|
||||
config.setContractsDslDir(isInsideProject() ? contractsDirectory : source);
|
||||
config.setContractsDslDir(isInsideProject() ? this.contractsDirectory : this.source);
|
||||
config.setStubsOutputDir(
|
||||
isInsideProject() ? new File(outputDirectory, "mappings") : destination);
|
||||
isInsideProject() ? new File(this.outputDirectory, "mappings") : this.destination);
|
||||
|
||||
getLog().info(
|
||||
"Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings");
|
||||
@@ -106,7 +106,7 @@ public class ConvertMojo extends AbstractMojo {
|
||||
}
|
||||
|
||||
private boolean isInsideProject() {
|
||||
return mavenSession.getRequest().isProjectPresent();
|
||||
return this.mavenSession.getRequest().isProjectPresent();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,15 +51,15 @@ class CopyContracts {
|
||||
MavenResourcesExecution execution = new MavenResourcesExecution();
|
||||
execution.setResources(Collections.singletonList(resource));
|
||||
execution.setOutputDirectory(new File(outputDirectory, "contracts"));
|
||||
execution.setMavenProject(project);
|
||||
execution.setMavenProject(this.project);
|
||||
execution.setEncoding("UTF-8");
|
||||
execution.setMavenSession(mavenSession);
|
||||
execution.setMavenSession(this.mavenSession);
|
||||
execution.setInjectProjectBuildFilters(false);
|
||||
execution.setOverwrite(true);
|
||||
execution.setIncludeEmptyDirs(false);
|
||||
execution.setFilterFilenames(false);
|
||||
try {
|
||||
mavenResourcesFiltering.filterResources(execution);
|
||||
this.mavenResourcesFiltering.filterResources(execution);
|
||||
}
|
||||
catch (MavenFilteringException e) {
|
||||
throw new MojoExecutionException(e.getMessage(), e);
|
||||
|
||||
@@ -66,14 +66,14 @@ public class GenerateStubsMojo extends AbstractMojo {
|
||||
private String classifier;
|
||||
|
||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||
if (skip) {
|
||||
if (this.skip) {
|
||||
getLog().info(
|
||||
"Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip="
|
||||
+ skip);
|
||||
+ this.skip);
|
||||
return;
|
||||
}
|
||||
File stubsJarFile = createStubJar(outputDirectory);
|
||||
projectHelper.attachArtifact(project, "jar", classifier, stubsJarFile);
|
||||
File stubsJarFile = createStubJar(this.outputDirectory);
|
||||
this.projectHelper.attachArtifact(this.project, "jar", this.classifier, stubsJarFile);
|
||||
}
|
||||
|
||||
private File createStubJar(File stubsOutputDir)
|
||||
@@ -84,29 +84,29 @@ public class GenerateStubsMojo extends AbstractMojo {
|
||||
+ "] .\nPlease make sure that spring-cloud-contract:convert was invoked");
|
||||
}
|
||||
String stubArchiveName =
|
||||
project.getBuild().getFinalName() + "-" + classifier + ".jar";
|
||||
File stubsJarFile = new File(projectBuildDirectory, stubArchiveName);
|
||||
this.project.getBuild().getFinalName() + "-" + this.classifier + ".jar";
|
||||
File stubsJarFile = new File(this.projectBuildDirectory, stubArchiveName);
|
||||
try {
|
||||
if (attachContracts) {
|
||||
archiver.addDirectory(stubsOutputDir,
|
||||
if (this.attachContracts) {
|
||||
this.archiver.addDirectory(stubsOutputDir,
|
||||
new String[] { STUB_MAPPING_FILE_PATTERN, CONTRACT_FILE_PATTERN },
|
||||
new String[0]);
|
||||
}
|
||||
else {
|
||||
getLog().info(
|
||||
"Skipping attaching Spring Cloud Contract Verifier contracts");
|
||||
archiver.addDirectory(stubsOutputDir,
|
||||
this.archiver.addDirectory(stubsOutputDir,
|
||||
new String[] { STUB_MAPPING_FILE_PATTERN },
|
||||
new String[] { CONTRACT_FILE_PATTERN });
|
||||
}
|
||||
archiver.setCompress(true);
|
||||
archiver.setDestFile(stubsJarFile);
|
||||
archiver.addConfiguredManifest(ManifestCreator.createManifest(project));
|
||||
archiver.createArchive();
|
||||
this.archiver.setCompress(true);
|
||||
this.archiver.setDestFile(stubsJarFile);
|
||||
this.archiver.addConfiguredManifest(ManifestCreator.createManifest(this.project));
|
||||
this.archiver.createArchive();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new MojoFailureException(
|
||||
"Exception while packaging " + classifier + " jar.", e);
|
||||
"Exception while packaging " + this.classifier + " jar.", e);
|
||||
}
|
||||
return stubsJarFile;
|
||||
}
|
||||
|
||||
@@ -106,32 +106,32 @@ public class GenerateTestsMojo extends AbstractMojo {
|
||||
@Parameter(property = "skipTests", defaultValue = "false") private boolean skipTests;
|
||||
|
||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||
if (skip || mavenTestSkip || skipTests) {
|
||||
if (skip) getLog().info("Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip=" + skip);
|
||||
if (mavenTestSkip) getLog().info("Skipping Spring Cloud Contract Verifier execution: maven.test.skip=" + mavenTestSkip);
|
||||
if (skipTests) getLog().info("Skipping Spring Cloud Contract Verifier execution: skipTests" + skipTests);
|
||||
if (this.skip || this.mavenTestSkip || this.skipTests) {
|
||||
if (this.skip) getLog().info("Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip=" + this.skip);
|
||||
if (this.mavenTestSkip) getLog().info("Skipping Spring Cloud Contract Verifier execution: maven.test.skip=" + this.mavenTestSkip);
|
||||
if (this.skipTests) getLog().info("Skipping Spring Cloud Contract Verifier execution: skipTests" + this.skipTests);
|
||||
return;
|
||||
}
|
||||
getLog().info(
|
||||
"Generating server tests source code for Spring Cloud Contract Verifier contract verification");
|
||||
final ContractVerifierConfigProperties config = new ContractVerifierConfigProperties();
|
||||
config.setContractsDslDir(contractsDirectory);
|
||||
config.setGeneratedTestSourcesDir(generatedTestSourcesDir);
|
||||
config.setTargetFramework(testFramework);
|
||||
config.setTestMode(testMode);
|
||||
config.setBasePackageForTests(basePackageForTests);
|
||||
config.setBaseClassForTests(baseClassForTests);
|
||||
config.setRuleClassForTests(ruleClassForTests);
|
||||
config.setNameSuffixForTests(nameSuffixForTests);
|
||||
config.setImports(imports);
|
||||
config.setStaticImports(staticImports);
|
||||
config.setIgnoredFiles(ignoredFiles);
|
||||
config.setExcludedFiles(excludedFiles);
|
||||
config.setAssertJsonSize(assertJsonSize);
|
||||
project.addTestCompileSourceRoot(generatedTestSourcesDir.getAbsolutePath());
|
||||
config.setContractsDslDir(this.contractsDirectory);
|
||||
config.setGeneratedTestSourcesDir(this.generatedTestSourcesDir);
|
||||
config.setTargetFramework(this.testFramework);
|
||||
config.setTestMode(this.testMode);
|
||||
config.setBasePackageForTests(this.basePackageForTests);
|
||||
config.setBaseClassForTests(this.baseClassForTests);
|
||||
config.setRuleClassForTests(this.ruleClassForTests);
|
||||
config.setNameSuffixForTests(this.nameSuffixForTests);
|
||||
config.setImports(this.imports);
|
||||
config.setStaticImports(this.staticImports);
|
||||
config.setIgnoredFiles(this.ignoredFiles);
|
||||
config.setExcludedFiles(this.excludedFiles);
|
||||
config.setAssertJsonSize(this.assertJsonSize);
|
||||
this.project.addTestCompileSourceRoot(this.generatedTestSourcesDir.getAbsolutePath());
|
||||
if (getLog().isInfoEnabled()) {
|
||||
getLog().info(
|
||||
"Test Source directory: " + generatedTestSourcesDir.getAbsolutePath()
|
||||
"Test Source directory: " + this.generatedTestSourcesDir.getAbsolutePath()
|
||||
+ " added.");
|
||||
getLog().info("Using " + config.getBaseClassForTests()
|
||||
+ " as base class for test classes");
|
||||
@@ -149,7 +149,7 @@ public class GenerateTestsMojo extends AbstractMojo {
|
||||
}
|
||||
|
||||
public List<String> getExcludedFiles() {
|
||||
return excludedFiles;
|
||||
return this.excludedFiles;
|
||||
}
|
||||
|
||||
public void setExcludedFiles(List<String> excludedFiles) {
|
||||
@@ -157,7 +157,7 @@ public class GenerateTestsMojo extends AbstractMojo {
|
||||
}
|
||||
|
||||
public List<String> getIgnoredFiles() {
|
||||
return ignoredFiles;
|
||||
return this.ignoredFiles;
|
||||
}
|
||||
|
||||
public void setIgnoredFiles(List<String> ignoredFiles) {
|
||||
@@ -165,7 +165,7 @@ public class GenerateTestsMojo extends AbstractMojo {
|
||||
}
|
||||
|
||||
public boolean isAssertJsonSize() {
|
||||
return assertJsonSize;
|
||||
return this.assertJsonSize;
|
||||
}
|
||||
|
||||
public void setAssertJsonSize(boolean assertJsonSize) {
|
||||
|
||||
@@ -97,25 +97,25 @@ public class RunMojo extends AbstractMojo {
|
||||
}
|
||||
|
||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||
if (skip || skipTestOnly) {
|
||||
getLog().info("Skipping verifier execution: spring.cloud.contract.verifier.skip=" + skip);
|
||||
if (this.skip || this.skipTestOnly) {
|
||||
getLog().info("Skipping verifier execution: spring.cloud.contract.verifier.skip=" + this.skip);
|
||||
return;
|
||||
}
|
||||
BatchStubRunner batchStubRunner = null;
|
||||
StubRunnerOptionsBuilder optionsBuilder = new StubRunnerOptionsBuilder()
|
||||
.withStubsClassifier(stubsClassifier);
|
||||
if (isNullOrEmpty(stubs)) {
|
||||
.withStubsClassifier(this.stubsClassifier);
|
||||
if (isNullOrEmpty(this.stubs)) {
|
||||
StubRunnerOptions options = optionsBuilder
|
||||
.withPort(httpPort)
|
||||
.withPort(this.httpPort)
|
||||
.build();
|
||||
StubRunner stubRunner = localStubRunner.run(resolveStubsDirectory().getAbsolutePath(), options);
|
||||
StubRunner stubRunner = this.localStubRunner.run(resolveStubsDirectory().getAbsolutePath(), options);
|
||||
batchStubRunner = new BatchStubRunner(Collections.singleton(stubRunner));
|
||||
} else {
|
||||
StubRunnerOptions options = optionsBuilder
|
||||
.withStubs(stubs)
|
||||
.withMinMaxPort(minPort, maxPort)
|
||||
.withStubs(this.stubs)
|
||||
.withMinMaxPort(this.minPort, this.maxPort)
|
||||
.build();
|
||||
batchStubRunner = remoteStubRunner.run(options, repoSession);
|
||||
batchStubRunner = this.remoteStubRunner.run(options, this.repoSession);
|
||||
}
|
||||
pressAnyKeyToContinue();
|
||||
if (batchStubRunner != null) {
|
||||
@@ -129,9 +129,9 @@ public class RunMojo extends AbstractMojo {
|
||||
|
||||
private File resolveStubsDirectory() {
|
||||
if (isInsideProject()) {
|
||||
return stubsDirectory;
|
||||
return this.stubsDirectory;
|
||||
} else {
|
||||
return destination;
|
||||
return this.destination;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public class RunMojo extends AbstractMojo {
|
||||
}
|
||||
|
||||
private boolean isInsideProject() {
|
||||
return mavenSession.getRequest().isProjectPresent();
|
||||
return this.mavenSession.getRequest().isProjectPresent();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AetherStubDownloaderFactory {
|
||||
}
|
||||
|
||||
public AetherStubDownloader build(RepositorySystemSession repoSession) {
|
||||
return new AetherStubDownloader(repoSystem,
|
||||
project.getRemoteProjectRepositories(), repoSession);
|
||||
return new AetherStubDownloader(this.repoSystem,
|
||||
this.project.getRemoteProjectRepositories(), repoSession);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RemoteStubRunner {
|
||||
}
|
||||
|
||||
public BatchStubRunner run(StubRunnerOptions options, RepositorySystemSession repositorySystemSession) {
|
||||
AetherStubDownloader stubDownloader = aetherStubDownloaderFactory.build(repositorySystemSession);
|
||||
AetherStubDownloader stubDownloader = this.aetherStubDownloaderFactory.build(repositorySystemSession);
|
||||
try {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Launching StubRunner with args: " + options);
|
||||
|
||||
@@ -46,8 +46,8 @@ public class PluginIT {
|
||||
|
||||
@Test
|
||||
public void should_build_project_Spring_Boot_Groovy_with_Accurest() throws Exception {
|
||||
File basedir = resources.getBasedir("spring-boot-groovy");
|
||||
maven.forProject(basedir)
|
||||
File basedir = this.resources.getBasedir("spring-boot-groovy");
|
||||
this.maven.forProject(basedir)
|
||||
.execute("package")
|
||||
.assertErrorFreeLog()
|
||||
.assertLogText("Generating server tests source code for Spring Cloud Contract Verifier contract verification")
|
||||
@@ -60,8 +60,8 @@ public class PluginIT {
|
||||
|
||||
@Test
|
||||
public void should_build_project_Spring_Boot_Java_with_Accurest() throws Exception {
|
||||
File basedir = resources.getBasedir("spring-boot-java");
|
||||
maven.forProject(basedir)
|
||||
File basedir = this.resources.getBasedir("spring-boot-java");
|
||||
this.maven.forProject(basedir)
|
||||
.execute("package")
|
||||
.assertErrorFreeLog()
|
||||
.assertLogText("Generating server tests source code for Spring Cloud Contract Verifier contract verification")
|
||||
@@ -74,8 +74,8 @@ public class PluginIT {
|
||||
|
||||
@Test
|
||||
public void should_build_project_with_plugin_extension() throws Exception {
|
||||
File basedir = resources.getBasedir("plugin-extension");
|
||||
maven.forProject(basedir)
|
||||
File basedir = this.resources.getBasedir("plugin-extension");
|
||||
this.maven.forProject(basedir)
|
||||
.execute("package")
|
||||
.assertErrorFreeLog()
|
||||
.assertLogText("Generating server tests source code for Spring Cloud Contract Verifier contract verification")
|
||||
@@ -89,8 +89,8 @@ public class PluginIT {
|
||||
@Test
|
||||
@Ignore("Ignored, because of bug accurest#245")
|
||||
public void should_build_project_project_with_complex_configuration() throws Exception {
|
||||
File basedir = resources.getBasedir("complex-configuration");
|
||||
maven.forProject(basedir)
|
||||
File basedir = this.resources.getBasedir("complex-configuration");
|
||||
this.maven.forProject(basedir)
|
||||
.execute("package")
|
||||
.assertErrorFreeLog()
|
||||
.assertLogText("Tests run: 2, Failures: 0, Errors: 0, Skipped: 1")
|
||||
@@ -100,12 +100,12 @@ public class PluginIT {
|
||||
|
||||
@Test
|
||||
public void should_convert_Accurest_Contracts_to_WireMock_Stubs_mappings() throws Exception {
|
||||
File basedir = resources.getBasedir("pomless");
|
||||
properties.getPluginVersion();
|
||||
maven.forProject(basedir)
|
||||
File basedir = this.resources.getBasedir("pomless");
|
||||
this.properties.getPluginVersion();
|
||||
this.maven.forProject(basedir)
|
||||
.withCliOption("-X")
|
||||
.execute(String.format("org.springframework.cloud:spring-cloud-contract-maven-plugin:%s:convert",
|
||||
properties.getPluginVersion()))
|
||||
this.properties.getPluginVersion()))
|
||||
.assertLogText("Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings")
|
||||
.assertLogText("Creating new json")
|
||||
.assertErrorFreeLog();
|
||||
|
||||
@@ -40,62 +40,62 @@ public class PluginUnitTest {
|
||||
|
||||
@Test
|
||||
public void shouldGenerateWireMockStubsInDefaultLocation() throws Exception {
|
||||
File basedir = resources.getBasedir("basic");
|
||||
maven.executeMojo(basedir, "convert");
|
||||
File basedir = this.resources.getBasedir("basic");
|
||||
this.maven.executeMojo(basedir, "convert");
|
||||
assertFilesPresent(basedir, "target/stubs/mappings/Sample.json");
|
||||
assertFilesNotPresent(basedir, "target/stubs/mappings/Messaging.json");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGenerateWireMockFromStubsDirectory() throws Exception {
|
||||
File basedir = resources.getBasedir("withStubs");
|
||||
maven.executeMojo(basedir, "convert", newParameter("contractsDirectory", "src/test/resources/stubs"));
|
||||
File basedir = this.resources.getBasedir("withStubs");
|
||||
this.maven.executeMojo(basedir, "convert", newParameter("contractsDirectory", "src/test/resources/stubs"));
|
||||
assertFilesPresent(basedir, "target/stubs/mappings/Sample.json");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCopyContracts() throws Exception {
|
||||
File basedir = resources.getBasedir("basic");
|
||||
maven.executeMojo(basedir, "convert");
|
||||
File basedir = this.resources.getBasedir("basic");
|
||||
this.maven.executeMojo(basedir, "convert");
|
||||
assertFilesPresent(basedir, "target/stubs/contracts/Sample.groovy");
|
||||
assertFilesPresent(basedir, "target/stubs/contracts/Messaging.groovy");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGenerateWireMockStubsInSelectedLocation() throws Exception {
|
||||
File basedir = resources.getBasedir("basic");
|
||||
maven.executeMojo(basedir, "convert", newParameter("outputDirectory", "target/foo"));
|
||||
File basedir = this.resources.getBasedir("basic");
|
||||
this.maven.executeMojo(basedir, "convert", newParameter("outputDirectory", "target/foo"));
|
||||
assertFilesPresent(basedir, "target/foo/mappings/Sample.json");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGenerateContractSpecificationInDefaultLocation() throws Exception {
|
||||
File basedir = resources.getBasedir("basic");
|
||||
maven.executeMojo(basedir, "generateTests", newParameter("testFramework", "SPOCK"));
|
||||
File basedir = this.resources.getBasedir("basic");
|
||||
this.maven.executeMojo(basedir, "generateTests", newParameter("testFramework", "SPOCK"));
|
||||
assertFilesPresent(basedir,
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierSpec.groovy");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGenerateContractTestsInDefaultLocation() throws Exception {
|
||||
File basedir = resources.getBasedir("basic");
|
||||
maven.executeMojo(basedir, "generateTests");
|
||||
File basedir = this.resources.getBasedir("basic");
|
||||
this.maven.executeMojo(basedir, "generateTests");
|
||||
assertFilesPresent(basedir,
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGenerateContractTestsWithCustomImports() throws Exception {
|
||||
File basedir = resources.getBasedir("basic");
|
||||
maven.executeMojo(basedir, "generateTests", newParameter("imports", ""));
|
||||
File basedir = this.resources.getBasedir("basic");
|
||||
this.maven.executeMojo(basedir, "generateTests", newParameter("imports", ""));
|
||||
assertFilesPresent(basedir,
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGenerateContractTestsWithoutArraySize() throws Exception {
|
||||
File basedir = resources.getBasedir("basic");
|
||||
maven.executeMojo(basedir, "generateTests");
|
||||
File basedir = this.resources.getBasedir("basic");
|
||||
this.maven.executeMojo(basedir, "generateTests");
|
||||
assertFilesPresent(basedir,
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
File test = new File(basedir, "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
@@ -104,8 +104,8 @@ public class PluginUnitTest {
|
||||
|
||||
@Test
|
||||
public void shouldGenerateContractTestsWithArraySize() throws Exception {
|
||||
File basedir = resources.getBasedir("basic");
|
||||
maven.executeMojo(basedir, "generateTests", newParameter("assertJsonSize", "true"));
|
||||
File basedir = this.resources.getBasedir("basic");
|
||||
this.maven.executeMojo(basedir, "generateTests", newParameter("assertJsonSize", "true"));
|
||||
assertFilesPresent(basedir,
|
||||
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
File test = new File(basedir, "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
|
||||
@@ -114,23 +114,23 @@ public class PluginUnitTest {
|
||||
|
||||
@Test
|
||||
public void shouldGenerateStubs() throws Exception {
|
||||
File basedir = resources.getBasedir("generatedStubs");
|
||||
maven.executeMojo(basedir, "generateStubs");
|
||||
File basedir = this.resources.getBasedir("generatedStubs");
|
||||
this.maven.executeMojo(basedir, "generateStubs");
|
||||
assertFilesPresent(basedir, "target/sample-project-0.1-stubs.jar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGenerateStubsWithMappingsOnly() throws Exception {
|
||||
File basedir = resources.getBasedir("generatedStubs");
|
||||
maven.executeMojo(basedir, "generateStubs", newParameter("attachContracts", "false"));
|
||||
File basedir = this.resources.getBasedir("generatedStubs");
|
||||
this.maven.executeMojo(basedir, "generateStubs", newParameter("attachContracts", "false"));
|
||||
assertFilesPresent(basedir, "target/sample-project-0.1-stubs.jar");
|
||||
// FIXME: add assertion for jar content
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGenerateStubsWithCustomClassifier() throws Exception {
|
||||
File basedir = resources.getBasedir("generatedStubs");
|
||||
maven.executeMojo(basedir, "generateStubs", newParameter("classifier", "foo"));
|
||||
File basedir = this.resources.getBasedir("generatedStubs");
|
||||
this.maven.executeMojo(basedir, "generateStubs", newParameter("classifier", "foo"));
|
||||
assertFilesPresent(basedir, "target/sample-project-0.1-foo.jar");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user