public class StubRunnerExtension extends Object implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback, StubFinder
| Modifier and Type | Class and Description |
|---|---|
static class |
StubRunnerExtension.PortStubRunnerExtension
Helper class with additional port, related methods once you pick a stub to download
|
| Constructor and Description |
|---|
StubRunnerExtension() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
void |
beforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
StubRunnerExtension.PortStubRunnerExtension |
downloadLatestStub(String groupId,
String artifactId,
String classifier)
Group Id, artifact Id and classifier of a single stub to download in the latest
version
|
StubRunnerExtension.PortStubRunnerExtension |
downloadStub(String ivyNotation)
Ivy notation of a single stub to download.
|
StubRunnerExtension.PortStubRunnerExtension |
downloadStub(String groupId,
String artifactId)
Group Id, artifact Id of a single stub to download.
|
StubRunnerExtension.PortStubRunnerExtension |
downloadStub(String groupId,
String artifactId,
String version)
Group Id, artifact Id and version of a single stub to download
|
StubRunnerExtension.PortStubRunnerExtension |
downloadStub(String groupId,
String artifactId,
String version,
String classifier)
Group Id, artifact Id, version and classifier of a single stub to download
|
StubRunnerExtension |
downloadStubs(List<String> ivyNotations)
Stubs to download in Ivy notations
|
StubRunnerExtension |
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<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.
|
StubRunnerExtension |
maxPort(int maxPort)
Max value of port for WireMock server
|
StubRunnerExtension |
messageVerifier(MessageVerifier messageVerifier)
Pass the
MessageVerifier that this rule should use. |
StubRunnerExtension |
minPort(int minPort)
Min value of port for WireMock server
|
StubRunnerExtension |
options(StubRunnerOptions stubRunnerOptions)
Override all options
|
StubRunnerExtension |
repoRoot(String repoRoot)
String URI of repository containing stubs
|
StubRunnerExtension |
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. |
StubRunnerExtension |
withConsumerName(String consumerName)
Allows setting consumer name
|
StubRunnerExtension |
withDeleteStubsAfterTest(boolean deleteStubsAfterTest)
If set to
false will NOT delete stubs from a temporary folder after running
tests |
StubRunnerExtension |
withMappingsOutputFolder(String mappingsOutputFolder)
Allows setting the output folder for mappings
|
StubRunnerExtension |
withProperties(Map<String,String> properties)
Map of properties that can be passed to custom
StubDownloaderBuilder |
StubRunnerExtension |
withStubPerConsumer(boolean stubPerConsumer)
Allows stub per consumer
|
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallbackpublic void afterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
afterAll in interface org.junit.jupiter.api.extension.AfterAllCallbackpublic URL findStubUrl(String groupId, String artifactId) throws StubNotFoundException
StubFinderfindStubUrl in interface StubFindergroupId - - might be null. In that case a search only via artifactId takes
placeStubNotFoundExceptionpublic URL findStubUrl(String ivyNotation) throws StubNotFoundException
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 artifactStubNotFoundExceptionpublic RunningStubs findAllRunningStubs()
StubFinderfindAllRunningStubs in interface StubFinderpublic Map<StubConfiguration,Collection<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 StubTriggerpublic StubRunnerExtension 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 StubRunnerExtension options(StubRunnerOptions stubRunnerOptions)
StubRunnerOptionspublic StubRunnerExtension minPort(int minPort)
public StubRunnerExtension maxPort(int maxPort)
public StubRunnerExtension repoRoot(String repoRoot)
public StubRunnerExtension stubsMode(StubRunnerProperties.StubsMode stubsMode)
public StubRunnerExtension.PortStubRunnerExtension downloadStub(String groupId, String artifactId, String version, String classifier)
public StubRunnerExtension.PortStubRunnerExtension downloadLatestStub(String groupId, String artifactId, String classifier)
public StubRunnerExtension.PortStubRunnerExtension downloadStub(String groupId, String artifactId, String version)
public StubRunnerExtension.PortStubRunnerExtension downloadStub(String groupId, String artifactId)
public StubRunnerExtension.PortStubRunnerExtension downloadStub(String ivyNotation)
public StubRunnerExtension downloadStubs(String... ivyNotations)
public StubRunnerExtension downloadStubs(List<String> ivyNotations)
public StubRunnerExtension withStubPerConsumer(boolean stubPerConsumer)
public StubRunnerExtension withConsumerName(String consumerName)
public StubRunnerExtension withMappingsOutputFolder(String mappingsOutputFolder)
public StubRunnerExtension withDeleteStubsAfterTest(boolean deleteStubsAfterTest)
false will NOT delete stubs from a temporary folder after running
testspublic StubRunnerExtension withProperties(Map<String,String> properties)
StubDownloaderBuilderCopyright © 2016–2018 Spring. All rights reserved.