contracts directory instead of stubs
This commit is contained in:
16
README.md
16
README.md
@@ -19,4 +19,18 @@ Sample usage
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
|
||||
Project default directories
|
||||
---
|
||||
|
||||
Contract definitions (_contractsDir_):
|
||||
|
||||
/src/test/resources/contracts
|
||||
|
||||
Generated accurest specifications (_generatedTestSourcesDir_):
|
||||
|
||||
/target/generated-test-sources/accurest
|
||||
|
||||
@@ -24,7 +24,7 @@ public class GenerateSpecsMojo extends AbstractMojo {
|
||||
@Parameter(defaultValue = "${project.build.directory}", readonly = true)
|
||||
private File projectBuildDirectory;
|
||||
|
||||
@Parameter(property = "contractsDir", defaultValue = "/src/test/resources/stubs")
|
||||
@Parameter(property = "contractsDir", defaultValue = "/src/test/resources/contracts")
|
||||
private String contractsDir;
|
||||
|
||||
@Parameter(property = "generatedTestSourcesDir", defaultValue = "/generated-test-sources/accurest")
|
||||
|
||||
@@ -22,12 +22,12 @@ public class GenerateStubsMojo extends AbstractMojo {
|
||||
@Parameter(defaultValue = "${project.build.directory}", readonly = true)
|
||||
private File projectBuildDirectory;
|
||||
|
||||
@Parameter(property = "contractsDir", defaultValue = "/src/test/resources/contracts")
|
||||
private String contractsDir;
|
||||
|
||||
@Parameter(property = "mappingsDir", defaultValue = "mappings")
|
||||
private String mappingsDir;
|
||||
|
||||
@Parameter(property = "contractsDir", defaultValue = "/src/test/resources/stubs")
|
||||
private String contractsDir;
|
||||
|
||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||
AccurestConfigProperties config = new AccurestConfigProperties();
|
||||
config.setContractsDslDir(new File(baseDir, contractsDir));
|
||||
|
||||
@@ -25,6 +25,13 @@ public class PluginUnitTest {
|
||||
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");
|
||||
@@ -32,13 +39,6 @@ public class PluginUnitTest {
|
||||
assertFilesPresent(basedir, "target/foo/Sample.json");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGenerateWiremockStubsInSelectedLocation2() throws Exception {
|
||||
File basedir = resources.getBasedir("customContractsLocation");
|
||||
maven.executeMojo(basedir, "generateStubs", TestMavenRuntime.newParameter("contractsDir", "src/foo"));
|
||||
assertFilesPresent(basedir, "target/mappings/Sample.json");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGenerateContractSpecificationInDefaultLocation() throws Exception {
|
||||
File basedir = resources.getBasedir("basic");
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
</executions>
|
||||
<configuration>
|
||||
<baseClassForTests>com.ofg.twitter.place.BaseMockMvcSpec</baseClassForTests>
|
||||
<stubs>/src/test/resources/stubs</stubs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
||||
Reference in New Issue
Block a user