diff --git a/pom.xml b/pom.xml index 5417aad6a9..a8473b110f 100644 --- a/pom.xml +++ b/pom.xml @@ -56,12 +56,7 @@ ${mavenVersion} test - - javax.inject - javax.inject - 1 - provided - + org.apache.maven maven-plugin-api @@ -81,6 +76,13 @@ 2.8.0 test + + io.takari.maven.plugins + takari-plugin-integration-testing + 2.8.0 + pom + test + junit diff --git a/src/test/java/io/codearte/accurest/maven/PluginIntegrationTest.java b/src/test/java/io/codearte/accurest/maven/PluginIntegrationTest.java new file mode 100644 index 0000000000..839ddb36a6 --- /dev/null +++ b/src/test/java/io/codearte/accurest/maven/PluginIntegrationTest.java @@ -0,0 +1,36 @@ +package io.codearte.accurest.maven; + +import java.io.File; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +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; + +@RunWith(MavenJUnitTestRunner.class) +@MavenVersions({ "3.3.3" }) +public class PluginIntegrationTest { + + @Rule + public final TestResources resources = new TestResources(); + + private final MavenRuntime maven; + + public PluginIntegrationTest(MavenRuntime.MavenRuntimeBuilder mavenBuilder) throws Exception { + this.maven = mavenBuilder.withCliOptions("-B", "-U").build(); + } + + @Test + public void test() throws Exception { + File basedir = resources.getBasedir("basic-with-execution"); + maven.forProject(basedir) + .withCliOption("-X") + .execute("package") + .assertErrorFreeLog() + .assertLogText("Accurest Plugin: Invoking GroovyDSL to WireMock client stubs conversion"); + } +} \ No newline at end of file diff --git a/src/test/projects/example/pom.xml b/src/test/projects/basic-with-execution/pom.xml similarity index 78% rename from src/test/projects/example/pom.xml rename to src/test/projects/basic-with-execution/pom.xml index faa1b92be3..3cbb096806 100644 --- a/src/test/projects/example/pom.xml +++ b/src/test/projects/basic-with-execution/pom.xml @@ -13,8 +13,15 @@ io.codearte.accurest accurest-maven-plugin ${it-plugin.version} + true + + + + generateStubs + + + - \ No newline at end of file diff --git a/src/test/projects/basic-with-execution/src/test/resources/stubs/Sample.groovy b/src/test/projects/basic-with-execution/src/test/resources/stubs/Sample.groovy new file mode 100644 index 0000000000..673ab7bd8d --- /dev/null +++ b/src/test/projects/basic-with-execution/src/test/resources/stubs/Sample.groovy @@ -0,0 +1,18 @@ +io.codearte.accurest.dsl.GroovyDsl.make { + request { + method 'POST' + url('/users') { + + } + headers { + header 'Content-Type': 'application/json' + } + body '''{ "login" : "john", "name": "John The Contract" }''' + } + response { + status 200 + headers { + header 'Location': '/users/john' + } + } +} \ No newline at end of file