publishing stubs to repository

This commit is contained in:
Mariusz Smykula
2016-03-28 17:12:29 +02:00
parent 7c4f6de2d1
commit 2f39d77fcc
27 changed files with 359 additions and 145 deletions

View File

@@ -1,53 +0,0 @@
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 shouldCreateStubs() throws Exception {
File basedir = resources.getBasedir("basic-with-execution");
maven.forProject(basedir)
.withCliOption("-X")
.execute("package")
.assertLogText("Accurest Plugin: Invoking GroovyDSL to WireMock client stubs conversion");
}
@Test
public void shouldCreateSpecs() throws Exception {
File basedir = resources.getBasedir("basic-with-execution");
maven.forProject(basedir)
.execute("package")
.assertLogText("Accurest Plugin: Invoking test sources generation");
}
@Test
public void shouldBuildAndTestSimpleBootProject() throws Exception {
File basedir = resources.getBasedir("bootSimple");
maven.forProject(basedir)
.execute("package")
.assertErrorFreeLog()
.assertLogText("Accurest Plugin: Invoking test sources generation")
.assertLogText("Generated 1 test classes.");
}
}

View File

@@ -1,49 +0,0 @@
package io.codearte.accurest.maven;
import static io.takari.maven.testing.TestResources.assertFilesPresent;
import java.io.File;
import org.junit.Rule;
import org.junit.Test;
import io.takari.maven.testing.TestMavenRuntime;
import io.takari.maven.testing.TestResources;
public class PluginUnitTest {
@Rule
public final TestResources resources = new TestResources();
@Rule
public final TestMavenRuntime maven = new TestMavenRuntime();
@Test
public void shouldGenerateWiremockStubsInDefaultcLocation() throws Exception {
File basedir = resources.getBasedir("basic");
maven.executeMojo(basedir, "generateStubs");
assertFilesPresent(basedir, "target/mappings/Sample.json");
}
@Test
public void shouldGenerateWiremockFromStubsDirectory() throws Exception {
File basedir = resources.getBasedir("withStubs");
maven.executeMojo(basedir, "generateStubs", TestMavenRuntime.newParameter("contractsDir", "/src/test/resources/stubs"));
assertFilesPresent(basedir, "target/mappings/Sample.json");
}
@Test
public void shouldGenerateWiremockStubsInSelectedLocation() throws Exception {
File basedir = resources.getBasedir("basic");
maven.executeMojo(basedir, "generateStubs", TestMavenRuntime.newParameter("mappingsDir", "foo"));
assertFilesPresent(basedir, "target/foo/Sample.json");
}
@Test
public void shouldGenerateContractSpecificationInDefaultLocation() throws Exception {
File basedir = resources.getBasedir("basic");
maven.executeMojo(basedir, "generateSpecs");
assertFilesPresent(basedir,
"target/generated-test-sources/accurest/io/codearte/accurest/tests/AccurestSpec.groovy");
}
}