public class StubRunnerRule extends Object implements org.junit.rules.TestRule, StubFinder
| 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 |
downloadLatestStub(String groupId,
String artifactId,
String classifier)
Group Id, artifact Id and classifier of a single stub to download in the latest version
|
StubRunnerRule |
downloadStub(String ivyNotation)
Ivy notation of a single stub to download.
|
StubRunnerRule |
downloadStub(String groupId,
String artifactId)
Group Id, artifact Id of a single stub to download.
|
StubRunnerRule |
downloadStub(String groupId,
String artifactId,
String version)
Group Id, artifact Id and version of a single stub to download
|
StubRunnerRule |
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
|
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 |
withPort(Integer port)
Appends port to last added stub
|
StubRunnerRule |
withStubPerConsumer(boolean stubPerConsumer)
Allows stub per consumer
|
StubRunnerRule |
workOffline(boolean workOffline)
Should download stubs or use only the local repository
|
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 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 workOffline(boolean workOffline)
public StubRunnerRule downloadStub(String groupId, String artifactId, String version, String classifier)
public StubRunnerRule downloadLatestStub(String groupId, String artifactId, String classifier)
public StubRunnerRule downloadStub(String groupId, String artifactId, String version)
public StubRunnerRule downloadStub(String groupId, String artifactId)
public StubRunnerRule downloadStub(String ivyNotation)
public StubRunnerRule downloadStubs(String... ivyNotations)
public StubRunnerRule downloadStubs(List<String> ivyNotations)
public StubRunnerRule withPort(Integer port)
public StubRunnerRule withStubPerConsumer(boolean stubPerConsumer)
public StubRunnerRule withConsumerName(String consumerName)
public 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–2017 Spring. All rights reserved.