@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
The classifier to use by default in ivy co-ordinates for a stub.
|
String |
consumerName
You can override the default
spring.application.name of this field by setting a value to this parameter. |
String[] |
ids
The ids of the stubs to run in "ivy" notation ([groupId]:artifactId[:version][:classifier][:port]).
|
String |
mappingsOutputFolder
For debugging purposes you can output the registered mappings to a given folder.
|
int |
maxPort
Max value of a port for the automatically started WireMock server
|
int |
minPort
Min value of a port for the automatically started WireMock server
|
String |
repositoryRoot
The repository root to use (where the stubs should be downloaded from)
|
boolean |
stubsPerConsumer
On the producer side the consumers can have a folder that contains contracts related only to them.
|
boolean |
workOffline
Should the stubs be checked for presence only locally
|
public abstract int minPort
public abstract int maxPort
public abstract boolean workOffline
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.Copyright © 2016–2018 Spring. All rights reserved.