diff --git a/pom.xml b/pom.xml
index 64e06fb604..85c9856b8d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,9 +55,8 @@
2.5.8
-
- 3.3.9
- 1.1.0
+ 3.6.2
+ 1.4.1
2.1.100
2.11.0
0.8.4
@@ -97,6 +96,16 @@
org.springframework.cloud
spring-cloud-function-compiler
${spring-cloud-function.version}
+
+
+ org.apache.maven
+ *
+
+
+ org.eclipse.aether
+ *
+
+
org.apache.camel
@@ -390,7 +399,7 @@
org.apache.maven
- maven-aether-provider
+ maven-resolver-provider
${maven.version}
@@ -404,29 +413,11 @@
${maven.version}
- org.eclipse.aether
- aether-api
- ${aether.version}
-
-
- org.eclipse.aether
- aether-impl
- ${aether.version}
-
-
- org.eclipse.aether
- aether-transport-file
- ${aether.version}
-
-
- org.eclipse.aether
- aether-transport-http
- ${aether.version}
-
-
- org.eclipse.aether
- aether-connector-basic
- ${aether.version}
+ org.apache.maven.resolver
+ maven-resolver
+ ${maven.resolver.version}
+ import
+ pom
com.rackspace.eclipse.webtools.sourceediting
diff --git a/spring-cloud-contract-dependencies/pom.xml b/spring-cloud-contract-dependencies/pom.xml
index d08f4a5c31..51d6d407fd 100644
--- a/spring-cloud-contract-dependencies/pom.xml
+++ b/spring-cloud-contract-dependencies/pom.xml
@@ -18,7 +18,7 @@
2.24.1
0.4.13
4.0.0
- 3.3.9
+ 3.6.2
diff --git a/spring-cloud-contract-shade/pom.xml b/spring-cloud-contract-shade/pom.xml
index f5900c1070..f197e68cad 100644
--- a/spring-cloud-contract-shade/pom.xml
+++ b/spring-cloud-contract-shade/pom.xml
@@ -8,7 +8,7 @@
0.1.1
4.2.0
4.2.2
- 27.1-jre
+ 28.1-jre
7.1
2.11.0
@@ -28,33 +28,53 @@
Spring Cloud Contract Shaded Dependencies
- org.eclipse.aether
- aether-api
+ org.apache.maven.resolver
+ maven-resolver-api
true
- org.eclipse.aether
- aether-impl
+ org.apache.maven.resolver
+ maven-resolver-spi
true
- org.eclipse.aether
- aether-transport-file
+ org.apache.maven.resolver
+ maven-resolver-util
true
- org.eclipse.aether
- aether-transport-http
+ org.apache.maven.resolver
+ maven-resolver-impl
true
- org.eclipse.aether
- aether-connector-basic
+ org.apache.maven.resolver
+ maven-resolver-connector-basic
+ true
+
+
+ org.apache.maven.resolver
+ maven-resolver-transport-classpath
+ true
+
+
+ org.apache.maven.resolver
+ maven-resolver-transport-file
+ true
+
+
+ org.apache.maven.resolver
+ maven-resolver-transport-http
+ true
+
+
+ org.apache.maven.resolver
+ maven-resolver-transport-wagon
true
org.apache.maven
- maven-aether-provider
+ maven-resolver-provider
true
diff --git a/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner/pom.xml b/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner/pom.xml
index 21be93ad82..c846d7d02b 100644
--- a/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner/pom.xml
+++ b/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner/pom.xml
@@ -55,8 +55,8 @@
- org.eclipse.aether
- aether-api
+ org.apache.maven.resolver
+ maven-resolver-api
diff --git a/spring-cloud-contract-stub-runner/pom.xml b/spring-cloud-contract-stub-runner/pom.xml
index 3100e10a90..194f3968d9 100644
--- a/spring-cloud-contract-stub-runner/pom.xml
+++ b/spring-cloud-contract-stub-runner/pom.xml
@@ -56,8 +56,8 @@
true
- org.eclipse.aether
- aether-api
+ org.apache.maven.resolver
+ maven-resolver-api
true
@@ -98,6 +98,8 @@
junit
junit
+ compile
+ true
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/pom.xml
index 9a41fced11..4852e26825 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/pom.xml
+++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/pom.xml
@@ -26,24 +26,21 @@
UTF-8
UTF-8
false
- 3.5
+ 3.6.0
- 2.22.0
+ 3.0.0-M3
1.5.7.1
3.1.1
- 2.9.2
- 2.9.2
-
3.0.0
3.0.0
- 3.5.2
+ 3.6.0
3.4.0
4.1.0
4.3.0
- 3.7.1
+ 3.8.2
2.0.0
- 1.13.7
+ 3.3.0
2016
@@ -63,21 +60,6 @@
-
- io.takari.maven.plugins
- takari-lifecycle-plugin
- ${takari-lifecycle-plugin.version}
- true
-
-
- testProperties
- process-test-resources
-
- testProperties
-
-
-
-
org.apache.maven.plugins
maven-failsafe-plugin
@@ -285,33 +267,33 @@
- org.eclipse.aether
- aether-api
+ org.apache.maven.resolver
+ maven-resolver-api
provided
- org.eclipse.aether
- aether-impl
+ org.apache.maven.resolver
+ maven-resolver-impl
provided
- org.eclipse.aether
- aether-transport-file
+ org.apache.maven.resolver
+ maven-resolver-transport-file
provided
- org.eclipse.aether
- aether-transport-http
+ org.apache.maven.resolver
+ maven-resolver-transport-http
provided
- org.eclipse.aether
- aether-connector-basic
+ org.apache.maven.resolver
+ maven-resolver-connector-basic
provided
org.apache.maven
- maven-aether-provider
+ maven-resolver-provider
provided
@@ -386,19 +368,6 @@
${plexus-archiver.version}
-
- io.takari.maven.plugins
- takari-plugin-testing
- ${takari-plugin-testing.version}
- test
-
-
- io.takari.maven.plugins
- takari-plugin-integration-testing
- ${takari-plugin-integration-testing.version}
- pom
- test
-
org.apache.maven
maven-compat
@@ -420,6 +389,12 @@
spring-cloud-contract-pact
test
+
+ org.apache.maven.plugin-testing
+ maven-plugin-testing-harness
+ ${maven-plugin-testing-harness.version}
+ test
+
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/java/org/springframework/cloud/contract/maven/verifier/AbstractMojoTest.java b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/java/org/springframework/cloud/contract/maven/verifier/AbstractMojoTest.java
new file mode 100644
index 0000000000..38dad22780
--- /dev/null
+++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/java/org/springframework/cloud/contract/maven/verifier/AbstractMojoTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2013-2019 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 java.io.IOException;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.testing.MojoRule;
+import org.apache.maven.project.MavenProject;
+import org.assertj.core.api.BDDAssertions;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+
+import org.springframework.boot.test.system.OutputCaptureRule;
+import org.springframework.util.FileSystemUtils;
+
+public abstract class AbstractMojoTest {
+
+ @Rule
+ public MojoRule rule = new MojoRule() {
+ @Override
+ protected void before() throws Throwable {
+ }
+
+ @Override
+ protected void after() {
+ }
+ };
+
+ @Rule
+ public TemporaryFolder tmp = new TemporaryFolder();
+
+ @Rule
+ public OutputCaptureRule capture = new OutputCaptureRule();
+
+ File tmpFolder;
+
+ @Before
+ public void setupTemp() throws IOException {
+ this.tmpFolder = this.tmp.newFolder();
+ File projects = new File("src/test/projects");
+ FileSystemUtils.copyRecursively(projects, this.tmpFolder);
+ }
+
+ protected File getBasedir(String name) {
+ return new File(this.tmpFolder, name);
+ }
+
+ protected void executeMojo(File baseDir, String goal, Xpp3Dom... parameters)
+ throws Exception {
+ MavenProject mavenProject = rule.readMavenProject(baseDir);
+ MavenSession mavenSession = rule.newMavenSession(mavenProject);
+ rule.executeMojo(mavenSession, mavenProject, goal, parameters);
+ }
+
+ protected void assertFilesPresent(File file, String name) {
+ BDDAssertions.then(new File(file, name)).exists();
+ }
+
+ protected void assertFilesNotPresent(File file, String name) {
+ BDDAssertions.then(new File(file, name)).doesNotExist();
+ }
+
+}
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/java/org/springframework/cloud/contract/maven/verifier/PluginIT.java b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/java/org/springframework/cloud/contract/maven/verifier/PluginIT.java
deleted file mode 100644
index 5a095ea0ab..0000000000
--- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/java/org/springframework/cloud/contract/maven/verifier/PluginIT.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2013-2019 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 io.takari.maven.testing.TestProperties;
-import io.takari.maven.testing.TestResources;
-import io.takari.maven.testing.executor.MavenRuntime;
-import io.takari.maven.testing.executor.MavenVersions;
-import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import org.springframework.util.SocketUtils;
-
-@RunWith(MavenJUnitTestRunner.class)
-@MavenVersions({ "3.5.0" })
-public class PluginIT {
-
- @Rule
- public final TestResources resources = new TestResources();
-
- private final TestProperties properties = new TestProperties();
-
- private final MavenRuntime maven;
-
- public PluginIT(MavenRuntime.MavenRuntimeBuilder mavenBuilder) throws Exception {
- this.maven = mavenBuilder.withCliOptions("-B", "-U").build();
- }
-
- @Before
- public void doNotRunForWindows() {
- Assume.assumeFalse(isWindows());
- }
-
- private boolean isWindows() {
- return System.getProperty("os.name").startsWith("Windows");
- }
-
- @Test
- public void should_build_project_Spring_Boot_Groovy_with_Accurest() throws Exception {
- 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")
- .assertLogText("Generated 1 test classes.")
- .assertLogText(
- "Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings")
- .assertLogText("Creating new stub")
- .assertLogText("Running hello.ContractVerifierSpec").assertErrorFreeLog();
- }
-
- @Test
- public void should_build_project_Spring_Boot_Java_with_Accurest() throws Exception {
- 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")
- .assertLogText("Generated 1 test classes.")
- .assertLogText(
- "Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings")
- .assertLogText("Creating new stub")
- .assertLogText("Running hello.ContractVerifierTest").assertErrorFreeLog();
- }
-
- @Test
- public void should_build_project_with_plugin_extension() throws Exception {
- 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")
- .assertLogText("Generated 1 test classes.")
- .assertLogText(
- "Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings")
- .assertLogText("Creating new stub")
- .assertLogText("Running hello.ContractVerifierTest").assertErrorFreeLog();
- }
-
- @Test
- public void should_convert_Accurest_Contracts_to_WireMock_Stubs_mappings()
- throws Exception {
- 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",
- this.properties.getPluginVersion()))
- .assertLogText(
- "Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings")
- .assertLogText("Creating new stub").assertErrorFreeLog();
- }
-
- @Test
- public void should_run_WireMock_Stubs_mappings() throws Exception {
- int availableTcpPort = SocketUtils.findAvailableTcpPort();
- File basedir = this.resources.getBasedir("generatedStubsOnly");
- this.properties.getPluginVersion();
- this.maven.forProject(basedir).withCliOption("-X")
- .withCliOption(
- "-Dspring.cloud.contract.verifier.http.port=" + availableTcpPort)
- .withCliOption(
- "-Dspring.cloud.contract.verifier.wait-for-key-pressed=false")
- .execute(String.format(
- "org.springframework.cloud:spring-cloud-contract-maven-plugin:%s:run",
- this.properties.getPluginVersion()))
- .assertLogText("All stubs are now running RunningStubs [namesAndPorts={="
- + availableTcpPort + "}]")
- .assertErrorFreeLog();
- }
-
-}
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/java/org/springframework/cloud/contract/maven/verifier/PluginUnitTest.java b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/java/org/springframework/cloud/contract/maven/verifier/PluginUnitTest.java
index 846ecfcc0f..979e0b91f8 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/java/org/springframework/cloud/contract/maven/verifier/PluginUnitTest.java
+++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/java/org/springframework/cloud/contract/maven/verifier/PluginUnitTest.java
@@ -18,37 +18,22 @@ package org.springframework.cloud.contract.maven.verifier;
import java.io.File;
-import io.takari.maven.testing.TestMavenRuntime;
-import io.takari.maven.testing.TestResources;
import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.util.StringUtils;
-import static io.takari.maven.testing.TestMavenRuntime.newParameter;
-import static io.takari.maven.testing.TestResources.assertFilesNotPresent;
-import static io.takari.maven.testing.TestResources.assertFilesPresent;
import static java.nio.charset.Charset.defaultCharset;
import static org.apache.commons.io.FileUtils.readFileToString;
+import static org.apache.maven.plugin.testing.MojoParameters.newParameter;
import static org.assertj.core.api.BDDAssertions.then;
-public class PluginUnitTest {
-
- @Rule
- public final TestResources resources = new TestResources();
-
- @Rule
- public final TestMavenRuntime maven = new TestMavenRuntime();
-
- @Rule
- public OutputCapture capture = new OutputCapture();
+public class PluginUnitTest extends AbstractMojoTest {
@Test
public void shouldGenerateWireMockStubsInDefaultLocation() throws Exception {
- File basedir = this.resources.getBasedir("basic");
- this.maven.executeMojo(basedir, "convert", defaultPackageForTests());
+ File basedir = getBasedir("basic");
+ executeMojo(basedir, "convert");
assertFilesPresent(basedir,
"target/stubs/META-INF/org.springframework.cloud.verifier.sample/sample-project/0.1/mappings/Sample.json"
.replace("/", File.separator));
@@ -64,8 +49,8 @@ public class PluginUnitTest {
@Test
public void shouldGenerateWireMockFromStubsDirectory() throws Exception {
- File basedir = this.resources.getBasedir("withStubs");
- this.maven.executeMojo(basedir, "convert", defaultPackageForTests(),
+ File basedir = getBasedir("withStubs");
+ executeMojo(basedir, "convert",
newParameter("contractsDirectory", "src/test/resources/stubs"));
assertFilesPresent(basedir,
"target/stubs/META-INF/org.springframework.cloud.verifier.sample/sample-project/0.1/mappings/Sample.json"
@@ -74,8 +59,8 @@ public class PluginUnitTest {
@Test
public void shouldCopyContracts() throws Exception {
- File basedir = this.resources.getBasedir("basic");
- this.maven.executeMojo(basedir, "convert", defaultPackageForTests());
+ File basedir = getBasedir("basic");
+ executeMojo(basedir, "convert");
assertFilesPresent(basedir,
"target/stubs/META-INF/org.springframework.cloud.verifier.sample/sample-project/0.1/contracts/Sample.groovy"
.replace("/", File.separator));
@@ -86,17 +71,16 @@ public class PluginUnitTest {
@Test
public void shouldGenerateWireMockStubsInSelectedLocation() throws Exception {
- File basedir = this.resources.getBasedir("basic");
- this.maven.executeMojo(basedir, "convert", defaultPackageForTests(),
- newParameter("stubsDirectory", "target/foo"));
+ File basedir = getBasedir("basic");
+ executeMojo(basedir, "convert", newParameter("stubsDirectory", "target/foo"));
assertFilesPresent(basedir,
"target/foo/META-INF/org.springframework.cloud.verifier.sample/sample-project/0.1/mappings/Sample.json");
}
@Test
public void shouldGenerateContractSpecificationInDefaultLocation() throws Exception {
- File basedir = this.resources.getBasedir("basic");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ File basedir = getBasedir("basic");
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("testFramework", "SPOCK"));
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierSpec.groovy";
assertFilesPresent(basedir, path);
@@ -106,16 +90,16 @@ public class PluginUnitTest {
@Test
public void shouldGenerateContractTestsInDefaultLocation() throws Exception {
- File basedir = this.resources.getBasedir("basic");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests());
+ File basedir = getBasedir("basic");
+ executeMojo(basedir, "generateTests", defaultPackageForTests());
assertFilesPresent(basedir,
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
}
@Test
public void shouldGenerateContractTestsWithCustomImports() throws Exception {
- File basedir = this.resources.getBasedir("basic");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ File basedir = getBasedir("basic");
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("imports", ""));
assertFilesPresent(basedir,
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
@@ -123,8 +107,8 @@ public class PluginUnitTest {
@Test
public void shouldGenerateContractTestsWithoutArraySize() throws Exception {
- File basedir = this.resources.getBasedir("basic");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests());
+ File basedir = getBasedir("basic");
+ executeMojo(basedir, "generateTests", defaultPackageForTests());
assertFilesPresent(basedir,
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
File test = new File(basedir,
@@ -134,8 +118,8 @@ public class PluginUnitTest {
@Test
public void shouldGenerateContractTestsWithArraySize() throws Exception {
- File basedir = this.resources.getBasedir("basic");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ File basedir = getBasedir("basic");
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("assertJsonSize", "true"));
assertFilesPresent(basedir,
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
@@ -146,32 +130,30 @@ public class PluginUnitTest {
@Test
public void shouldGenerateStubs() throws Exception {
- File basedir = this.resources.getBasedir("generatedStubs");
- this.maven.executeMojo(basedir, "generateStubs", defaultPackageForTests());
+ File basedir = getBasedir("generatedStubs");
+ executeMojo(basedir, "generateStubs");
assertFilesPresent(basedir, "target/sample-project-stubs.jar");
}
@Test
public void shouldGenerateStubsWithMappingsOnly() throws Exception {
- File basedir = this.resources.getBasedir("generatedStubs");
- this.maven.executeMojo(basedir, "generateStubs", defaultPackageForTests(),
- newParameter("attachContracts", "false"));
+ File basedir = getBasedir("generatedStubs");
+ executeMojo(basedir, "generateStubs");
assertFilesPresent(basedir, "target/sample-project-stubs.jar");
// FIXME: add assertion for jar content
}
@Test
public void shouldGenerateStubsWithCustomClassifier() throws Exception {
- File basedir = this.resources.getBasedir("generatedStubs");
- this.maven.executeMojo(basedir, "generateStubs", defaultPackageForTests(),
- newParameter("classifier", "foo"));
+ File basedir = getBasedir("generatedStubs");
+ executeMojo(basedir, "generateStubs", newParameter("classifier", "foo"));
assertFilesPresent(basedir, "target/sample-project-foo.jar");
}
@Test
public void shouldGenerateStubsByDownloadingContractsFromARepo() throws Exception {
- File basedir = this.resources.getBasedir("basic-remote-contracts");
- this.maven.executeMojo(basedir, "convert", defaultPackageForTests(),
+ File basedir = getBasedir("basic-remote-contracts");
+ executeMojo(basedir, "convert",
newParameter("contractsRepositoryUrl",
"file://" + PluginUnitTest.class.getClassLoader()
.getResource("m2repo/repository").getFile()
@@ -183,8 +165,8 @@ public class PluginUnitTest {
@Test
public void shouldGenerateStubsByDownloadingContractsFromARepoWhenCustomPathIsProvided()
throws Exception {
- File basedir = this.resources.getBasedir("complex-remote-contracts");
- this.maven.executeMojo(basedir, "convert", defaultPackageForTests(),
+ File basedir = getBasedir("complex-remote-contracts");
+ executeMojo(basedir, "convert",
newParameter("contractsRepositoryUrl",
"file://" + PluginUnitTest.class.getClassLoader()
.getResource("m2repo/repository").getFile()
@@ -199,8 +181,8 @@ public class PluginUnitTest {
@Test
public void shouldGenerateOutputWhenCalledConvertFromRootProject() throws Exception {
- File basedir = this.resources.getBasedir("different-module-configuration");
- this.maven.executeMojo(basedir, "convert", defaultPackageForTests());
+ File basedir = getBasedir("different-module-configuration");
+ executeMojo(basedir, "convert");
assertFilesPresent(basedir,
"target/stubs/META-INF/com.blogspot.toomuchcoding.frauddetection/frauddetection-parent/0.1.0/mappings/shouldMarkClientAsFraud.json");
}
@@ -208,16 +190,16 @@ public class PluginUnitTest {
@Test
public void shouldGenerateOutputWhenCalledGenerateTestsFromRootProject()
throws Exception {
- File basedir = this.resources.getBasedir("different-module-configuration");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests());
+ File basedir = getBasedir("different-module-configuration");
+ executeMojo(basedir, "generateTests", defaultPackageForTests());
assertFilesPresent(basedir,
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
}
@Test
public void shouldGenerateTestsByDownloadingContractsFromARepo() throws Exception {
- File basedir = this.resources.getBasedir("basic-remote-contracts");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ File basedir = getBasedir("basic-remote-contracts");
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("contractsRepositoryUrl",
"file://" + PluginUnitTest.class.getClassLoader()
.getResource("m2repo/repository").getFile()
@@ -229,8 +211,8 @@ public class PluginUnitTest {
@Test
public void shouldGenerateTestsByDownloadingContractsFromARepoWhenCustomPathIsProvided()
throws Exception {
- File basedir = this.resources.getBasedir("complex-remote-contracts");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ File basedir = getBasedir("complex-remote-contracts");
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("contractsRepositoryUrl",
"file://" + PluginUnitTest.class.getClassLoader()
.getResource("m2repo/repository").getFile()
@@ -246,9 +228,9 @@ public class PluginUnitTest {
@Test
public void shouldGenerateContractTestsWithBaseClassResolvedFromConvention()
throws Exception {
- File basedir = this.resources.getBasedir("basic-generated-baseclass");
+ File basedir = getBasedir("basic-generated-baseclass");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("testFramework", "JUNIT"));
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/hello/V1Test.java";
@@ -261,9 +243,9 @@ public class PluginUnitTest {
@Test
public void shouldGenerateContractTestsWithBaseClassResolvedFromConventionForSpock()
throws Exception {
- File basedir = this.resources.getBasedir("basic-generated-baseclass");
+ File basedir = getBasedir("basic-generated-baseclass");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("testFramework", "SPOCK"));
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/hello/V1Spec.groovy";
@@ -276,9 +258,9 @@ public class PluginUnitTest {
@Test
public void shouldGenerateContractTestsWithBaseClassResolvedFromMapping()
throws Exception {
- File basedir = this.resources.getBasedir("basic-baseclass-from-mappings");
+ File basedir = getBasedir("basic-baseclass-from-mappings");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("testFramework", "JUNIT"));
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/com/hello/V1Test.java";
@@ -291,9 +273,9 @@ public class PluginUnitTest {
@Test
public void shouldGenerateContractTestsWithBaseClassResolvedFromMappingNameForSpock()
throws Exception {
- File basedir = this.resources.getBasedir("basic-baseclass-from-mappings");
+ File basedir = getBasedir("basic-baseclass-from-mappings");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("testFramework", "SPOCK"));
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/com/hello/V1Spec.groovy";
@@ -306,9 +288,9 @@ public class PluginUnitTest {
@Test
public void shouldGenerateContractTestsWithAFileContainingAListOfContracts()
throws Exception {
- File basedir = this.resources.getBasedir("multiple-contracts");
+ File basedir = getBasedir("multiple-contracts");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("testFramework", "JUNIT"));
String path = "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/com/hello/V1Test.java";
@@ -322,10 +304,9 @@ public class PluginUnitTest {
@Test
public void shouldGenerateStubsWithAFileContainingAListOfContracts()
throws Exception {
- File basedir = this.resources.getBasedir("multiple-contracts");
+ File basedir = getBasedir("multiple-contracts");
- this.maven.executeMojo(basedir, "convert", defaultPackageForTests(),
- newParameter("stubsDirectory", "target/foo"));
+ executeMojo(basedir, "convert", newParameter("stubsDirectory", "target/foo"));
String firstFile = "target/foo/META-INF/org.springframework.cloud.verifier.sample/sample-project/0.1/mappings/com/hello/v1/should post a user.json";
File test = new File(basedir, firstFile);
@@ -341,14 +322,14 @@ public class PluginUnitTest {
@Test
public void shouldGenerateStubsForCommonRepoWithTargetFolder() throws Exception {
- File basedir = this.resources.getBasedir("common-repo");
+ File basedir = getBasedir("common-repo");
- this.maven.executeMojo(basedir, "convert", defaultPackageForTests());
+ executeMojo(basedir, "convert");
assertFilesNotPresent(basedir, "target/generated-test-sources/contracts/");
// there will be no stubs cause all files are copied to `target` folder
- assertFilesNotPresent(basedir,
- "target/stubs/META-INF/org.springframework.cloud.verifier.sample/common-repo/0.1/mappings/");
+ assertFilesPresent(basedir,
+ "target/stubs/META-INF/org.springframework.cloud.verifier.sample/common-repo/0.1/mappings/consumer1");
assertFilesPresent(basedir,
"target/stubs/META-INF/org.springframework.cloud.verifier.sample/common-repo/0.1/contracts/consumer1/Messaging.groovy");
assertFilesPresent(basedir,
@@ -357,9 +338,9 @@ public class PluginUnitTest {
@Test
public void shouldGenerateContractTestsForPactAndMaintainIndents() throws Exception {
- File basedir = this.resources.getBasedir("pact");
+ File basedir = getBasedir("pact");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests());
+ executeMojo(basedir, "generateTests", defaultPackageForTests());
assertFilesPresent(basedir,
"target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
@@ -373,9 +354,9 @@ public class PluginUnitTest {
@Test
public void shouldRunPushStubsToScm() throws Exception {
- File basedir = this.resources.getBasedir("git-basic-remote-contracts");
+ File basedir = getBasedir("git-basic-remote-contracts");
- this.maven.executeMojo(basedir, "pushStubsToScm", defaultPackageForTests());
+ executeMojo(basedir, "pushStubsToScm");
then(this.capture.toString())
.contains("Skipping pushing stubs to scm since your");
@@ -383,9 +364,9 @@ public class PluginUnitTest {
@Test
public void shouldGenerateContractTestsForIncludedFilesPattern() throws Exception {
- File basedir = this.resources.getBasedir("complex-common-repo-with-messaging");
+ File basedir = getBasedir("complex-common-repo-with-messaging");
- this.maven.executeMojo(basedir, "generateTests", defaultPackageForTests(),
+ executeMojo(basedir, "generateTests", defaultPackageForTests(),
newParameter("contractsRepositoryUrl",
"file://" + PluginUnitTest.class.getClassLoader()
.getResource("m2repo/repository").getFile()
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/basic/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/basic/pom.xml
index 1b0b426f80..0f72767fe2 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/basic/pom.xml
+++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/basic/pom.xml
@@ -31,6 +31,7 @@
org.springframework.cloud
spring-cloud-contract-maven-plugin
+
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/multiple-contracts/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/multiple-contracts/pom.xml
index 3975b5b21c..e37c2f3c00 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/multiple-contracts/pom.xml
+++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/multiple-contracts/pom.xml
@@ -31,6 +31,7 @@
org.springframework.cloud
spring-cloud-contract-maven-plugin
+
diff --git a/spring-cloud-contract-verifier/pom.xml b/spring-cloud-contract-verifier/pom.xml
index a3f8b826e8..51eec90dd1 100644
--- a/spring-cloud-contract-verifier/pom.xml
+++ b/spring-cloud-contract-verifier/pom.xml
@@ -3,6 +3,9 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
+
+ 2.1
+
org.springframework.cloud
spring-cloud-contract-parent
@@ -93,6 +96,10 @@
com.toomuchcoding.jsonassert
jsonassert
+
+ org.apache.maven.resolver
+ maven-resolver-api
+
com.rackspace.eclipse.webtools.sourceediting
org.eclipse.wst.xml.xpath2.processor
@@ -158,6 +165,11 @@
org.springframework.boot
spring-boot-starter-test
+
+ org.mockito
+ mockito-core
+ compile
+
org.slf4j
slf4j-simple
@@ -225,7 +237,7 @@
javax.ws.rs-api
javax.ws.rs
- 2.1
+ ${javax.ws.rs-api.version}
test