@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @ImportAutoConfiguration @AutoConfigureMessageVerifier @PropertyMapping(value="stubrunner", skip=ON_DEFAULT_VALUE) public @interface AutoConfigureStubRunner
| Modifier and Type | Optional Element and Description |
|---|---|
String |
classifier |
String |
consumerName
You can override the default
spring.application.name of this field by
setting a value to this parameter. |
boolean |
deleteStubsAfterTest |
boolean |
failOnNoStubs |
boolean |
generateStubs |
Class<? extends HttpServerStubConfigurer> |
httpServerStubConfigurer
Configuration for an HTTP server stub.
|
String[] |
ids |
String |
mappingsOutputFolder
For debugging purposes you can output the registered mappings to a given folder.
|
int |
maxPort |
int |
minPort |
String[] |
properties
Properties in form key=value.
|
String |
repositoryRoot |
StubRunnerProperties.StubsMode |
stubsMode
The way stubs should be found and registered.
|
boolean |
stubsPerConsumer
On the producer side the consumers can have a folder that contains contracts
related only to them.
|
public abstract int minPort
public abstract int maxPort
public abstract String repositoryRoot
public abstract String[] ids
groupId,
version, classifier and port can be optional.public abstract String classifier
public abstract boolean stubsPerConsumer
true we no longer register all
stubs but only those that correspond to the consumer application's name. In other
words we'll scan the path of every stub and if it contains the name of the consumer
in the path only then will it get registered.
Let's look at this example. Let's assume that we have a producer called foo
and two consumers baz and bar. On the foo producer side the
contracts would look like this
src/test/resources/contracts/baz-service/some/contracts/... and
src/test/resources/contracts/bar-service/some/contracts/....
Then when the consumer with spring.application.name or the
consumerName() annotation parameter set to
baz-service will define the test setup as follows
@AutoConfigureStubRunner(ids = "com.example:foo:+:stubs:8095", stubsPerConsumer=true)
then only the stubs registered under
src/test/resources/contracts/baz-service/some/contracts/... will get
registered and those under
src/test/resources/contracts/bar-service/some/contracts/... will get
ignored.true to turn on the featurepublic abstract String mappingsOutputFolder
public abstract StubRunnerProperties.StubsMode stubsMode
StubRunnerProperties.StubsMode.CLASSPATH.public abstract String[] properties
public abstract boolean deleteStubsAfterTest
false will NOT delete stubs from a temporary folder after
running testspublic abstract boolean generateStubs
public abstract boolean failOnNoStubs
public abstract Class<? extends HttpServerStubConfigurer> httpServerStubConfigurer
Copyright © 2016–2021 Spring. All rights reserved.