public class StubRunnerRule extends Object implements org.junit.rules.TestRule, StubFinder
| Modifier and Type | Class and Description |
|---|---|
static class |
StubRunnerRule.PortStubRunnerRule
Helper class with additional port, related methods once you pick a stub to download
|
| Constructor and Description |
|---|
StubRunnerRule() |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
StubRunnerRule.PortStubRunnerRule |
downloadLatestStub(String groupId,
String artifactId,
String classifier)
Group Id, artifact Id and classifier of a single stub to download in the latest version
|
StubRunnerRule.PortStubRunnerRule |
downloadStub(String ivyNotation)
Ivy notation of a single stub to download.
|
StubRunnerRule.PortStubRunnerRule |
downloadStub(String groupId,
String artifactId)
Group Id, artifact Id of a single stub to download.
|
StubRunnerRule.PortStubRunnerRule |
downloadStub(String groupId,
String artifactId,
String version)
Group Id, artifact Id and version of a single stub to download
|
StubRunnerRule.PortStubRunnerRule |
downloadStub(String groupId,
String artifactId,
String version,
String classifier)
Group Id, artifact Id, version and classifier of a single stub to download
|
StubRunnerRule |
downloadStubs(List<String> ivyNotations)
Stubs to download in Ivy notations
|
StubRunnerRule |
downloadStubs(String... ivyNotations)
Stubs to download in Ivy notations
|
RunningStubs |
findAllRunningStubs()
Returns all running stubs
|
URL |
findStubUrl(String ivyNotation)
For the given Ivy notation
[groupId]:artifactId:[version]:[classifier] tries to
find the matching URL of the running stub. |
URL |
findStubUrl(String groupId,
String artifactId)
For the given groupId and artifactId tries to find the matching
URL of the running stub.
|
Map<StubConfiguration,Collection<org.springframework.cloud.contract.spec.Contract>> |
getContracts()
Returns the list of Contracts
|
Map<String,Collection<String>> |
labels()
Returns a mapping of ivy notation of a dependency to all the labels it has.
|
StubRunnerRule |
maxPort(int maxPort)
Max value of port for WireMock server
|
StubRunnerRule |
messageVerifier(MessageVerifier messageVerifier)
Pass the
MessageVerifier that this rule should use. |
StubRunnerRule |
minPort(int minPort)
Min value of port for WireMock server
|
StubRunnerRule |
options(StubRunnerOptions stubRunnerOptions)
Override all options
|
StubRunnerRule |
repoRoot(String repoRoot)
String URI of repository containing stubs
|
StubRunnerRule |
stubsMode(StubRunnerProperties.StubsMode stubsMode)
Stubs mode that should be used
|
boolean |
trigger()
Triggers all possible events.
|
boolean |
trigger(String labelName)
Triggers an event by a given label.
|
boolean |
trigger(String ivyNotation,
String labelName)
Triggers an event by a given label for a given
groupid:artifactid notation. |
StubRunnerRule |
withConsumerName(String consumerName)
Allows setting consumer name
|
StubRunnerRule |
withDeleteStubsAfterTest(boolean deleteStubsAfterTest)
If set to
false will NOT delete stubs from a temporary
folder after running tests |
StubRunnerRule |
withMappingsOutputFolder(String mappingsOutputFolder)
Allows setting the output folder for mappings
|
StubRunnerRule |
withProperties(Map<String,String> properties)
Map of properties that can be passed to custom
StubDownloaderBuilder |
StubRunnerRule |
withSnapshotCheckSkip(boolean snapshotCheckSkip)
If set to
true will not assert whether the downloaded stubs / contract
JAR was downloaded from a remote location or a local one(only applicable to Maven repos, not Git or Pact) |
StubRunnerRule |
withStubPerConsumer(boolean stubPerConsumer)
Allows stub per consumer
|
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRulepublic StubRunnerRule messageVerifier(MessageVerifier messageVerifier)
MessageVerifier that this rule should use.
If you don't pass anything a StubRunnerRule.ExceptionThrowingMessageVerifier will be used.
That means that an exception will be thrown whenever you try to do sth messaging related.public StubRunnerRule options(StubRunnerOptions stubRunnerOptions)
StubRunnerOptionspublic StubRunnerRule minPort(int minPort)
public StubRunnerRule maxPort(int maxPort)
public StubRunnerRule repoRoot(String repoRoot)
public StubRunnerRule stubsMode(StubRunnerProperties.StubsMode stubsMode)
public StubRunnerRule.PortStubRunnerRule downloadStub(String groupId, String artifactId, String version, String classifier)
public StubRunnerRule.PortStubRunnerRule downloadLatestStub(String groupId, String artifactId, String classifier)
public StubRunnerRule.PortStubRunnerRule downloadStub(String groupId, String artifactId, String version)
public StubRunnerRule.PortStubRunnerRule downloadStub(String groupId, String artifactId)
public StubRunnerRule.PortStubRunnerRule downloadStub(String ivyNotation)
public StubRunnerRule downloadStubs(String... ivyNotations)
public StubRunnerRule downloadStubs(List<String> ivyNotations)
public StubRunnerRule withStubPerConsumer(boolean stubPerConsumer)
public StubRunnerRule withConsumerName(String consumerName)
public StubRunnerRule withMappingsOutputFolder(String mappingsOutputFolder)
public StubRunnerRule withSnapshotCheckSkip(boolean snapshotCheckSkip)
true will not assert whether the downloaded stubs / contract
JAR was downloaded from a remote location or a local one(only applicable to Maven repos, not Git or Pact)public StubRunnerRule withDeleteStubsAfterTest(boolean deleteStubsAfterTest)
false will NOT delete stubs from a temporary
folder after running testspublic StubRunnerRule withProperties(Map<String,String> properties)
StubDownloaderBuilderpublic URL findStubUrl(String groupId, String artifactId)
StubFinderfindStubUrl in interface StubFindergroupId - - might be null. In that case a search only via artifactId takes placepublic URL findStubUrl(String ivyNotation)
StubFinder[groupId]:artifactId:[version]:[classifier] tries to
find the matching URL of the running stub. You can also pass only artifactId.findStubUrl in interface StubFinderivyNotation - - Ivy representation of the Maven artifactpublic RunningStubs findAllRunningStubs()
StubFinderfindAllRunningStubs in interface StubFinderpublic Map<StubConfiguration,Collection<org.springframework.cloud.contract.spec.Contract>> getContracts()
StubFindergetContracts in interface StubFinderpublic boolean trigger(String ivyNotation, String labelName)
StubTriggergroupid:artifactid notation. You can use only artifactId too.
Feature related to messaging.trigger in interface StubTriggerpublic boolean trigger(String labelName)
StubTriggertrigger in interface StubTriggerpublic boolean trigger()
StubTriggertrigger in interface StubTriggerpublic Map<String,Collection<String>> labels()
StubTriggerlabels in interface StubTriggerCopyright © 2016–2018 Spring. All rights reserved.