Class StubRunnerRule.PortStubRunnerRule
java.lang.Object
org.springframework.cloud.contract.stubrunner.junit.StubRunnerRule
org.springframework.cloud.contract.stubrunner.junit.StubRunnerRule.PortStubRunnerRule
- All Implemented Interfaces:
org.junit.rules.TestRule,StubFinder,StubTrigger
- Enclosing class:
- StubRunnerRule
Helper class with additional port, related methods once you pick a stub to
download.
- Since:
- 1.2.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.cloud.contract.stubrunner.junit.StubRunnerRule
StubRunnerRule.PortStubRunnerRule -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.cloud.contract.stubrunner.junit.PortStubRunnerRuleOptionsdownloadLatestStub(String groupId, String artifactId, String classifier) org.springframework.cloud.contract.stubrunner.junit.PortStubRunnerRuleOptionsdownloadStub(String ivyNotation) org.springframework.cloud.contract.stubrunner.junit.PortStubRunnerRuleOptionsdownloadStub(String groupId, String artifactId) org.springframework.cloud.contract.stubrunner.junit.PortStubRunnerRuleOptionsdownloadStub(String groupId, String artifactId, String version) org.springframework.cloud.contract.stubrunner.junit.PortStubRunnerRuleOptionsdownloadStub(String groupId, String artifactId, String version, String classifier) downloadStubs(String... ivyNotations) downloadStubs(List<String> ivyNotations) failOnNoStubs(boolean failOnNoStubs) maxPort(int maxPort) messageVerifierReceiver(org.springframework.cloud.contract.verifier.messaging.MessageVerifierReceiver messageVerifier) Pass theMessageVerifierReceiverthat this rule should use.messageVerifierSender(org.springframework.cloud.contract.verifier.messaging.MessageVerifierSender messageVerifier) Pass theMessageVerifierSenderthat this rule should use.minPort(int minPort) options(StubRunnerOptions stubRunnerOptions) Override all options.stubsMode(StubRunnerProperties.StubsMode stubsMode) withConsumerName(String consumerName) withDeleteStubsAfterTest(boolean deleteStubsAfterTest) withGenerateStubs(boolean generateStubs) withHttpServerStubConfigurer(Class<? extends HttpServerStubConfigurer> httpServerStubConfigurer) withMappingsOutputFolder(String mappingsOutputFolder) withProperties(Map<String, String> properties) withStubPerConsumer(boolean stubPerConsumer) Methods inherited from class org.springframework.cloud.contract.stubrunner.junit.StubRunnerRule
apply, downloadLatestStub, downloadStub, downloadStub, downloadStub, downloadStub, downloadStubs, downloadStubs, failOnNoStubs, findAllRunningStubs, findStubUrl, findStubUrl, getContracts, labels, maxPort, messageVerifierReceiver, messageVerifierSender, minPort, options, repoRoot, stubsMode, trigger, trigger, trigger, withConsumerName, withDeleteStubsAfterTest, withGenerateStubs, withHttpServerStubConfigurer, withMappingsOutputFolder, withProperties, withStubPerConsumer
-
Method Details
-
withPort
-
messageVerifierSender
StubRunnerRule messageVerifierSender(org.springframework.cloud.contract.verifier.messaging.MessageVerifierSender messageVerifier) Pass theMessageVerifierSenderthat this rule should use. If you don't pass anything aExceptionThrowingMessageVerifierwill be used. That means that an exception will be thrown whenever you try to do sth messaging related.- Parameters:
messageVerifier- message verifier implementation- Returns:
- the rule
-
messageVerifierReceiver
StubRunnerRule messageVerifierReceiver(org.springframework.cloud.contract.verifier.messaging.MessageVerifierReceiver messageVerifier) Pass theMessageVerifierReceiverthat this rule should use. If you don't pass anything aExceptionThrowingMessageVerifierwill be used. That means that an exception will be thrown whenever you try to do sth messaging related.- Parameters:
messageVerifier- message verifier implementation- Returns:
- the rule
-
options
Override all options.- Parameters:
stubRunnerOptions- options of Stub Runner- Returns:
- the rule
- See Also:
-
minPort
- Parameters:
minPort- min value of port for WireMock server- Returns:
- the rule
-
maxPort
- Parameters:
maxPort- max value of port for WireMock server- Returns:
- the rule
-
repoRoot
- Parameters:
repoRoot- String URI of repository containing stubs- Returns:
- the rule
-
stubsMode
- Parameters:
stubsMode- Stubs mode that should be used- Returns:
- the rule
-
downloadStub
org.springframework.cloud.contract.stubrunner.junit.PortStubRunnerRuleOptions downloadStub(String groupId, String artifactId, String version, String classifier) - Parameters:
groupId- group id of the stubartifactId- artifact id of the stubversion- version of the stubclassifier- classifier of the stub- Returns:
- the rule with port
-
downloadLatestStub
org.springframework.cloud.contract.stubrunner.junit.PortStubRunnerRuleOptions downloadLatestStub(String groupId, String artifactId, String classifier) - Parameters:
groupId- group id of the stubartifactId- artifact id of the stubclassifier- classifier of the stub- Returns:
- the rule with port
-
downloadStub
org.springframework.cloud.contract.stubrunner.junit.PortStubRunnerRuleOptions downloadStub(String groupId, String artifactId, String version) - Parameters:
groupId- group id of the stubartifactId- artifact id of the stubversion- version of the stub- Returns:
- the rule with port
-
downloadStub
org.springframework.cloud.contract.stubrunner.junit.PortStubRunnerRuleOptions downloadStub(String groupId, String artifactId) - Parameters:
groupId- group id of the stubartifactId- artifact id of the stub- Returns:
- the rule with port
-
downloadStub
org.springframework.cloud.contract.stubrunner.junit.PortStubRunnerRuleOptions downloadStub(String ivyNotation) - Parameters:
ivyNotation- Ivy notation of a single stub to download.- Returns:
- the rule with port
-
downloadStubs
- Parameters:
ivyNotations- Stubs to download in Ivy notations.- Returns:
- the rule
-
downloadStubs
- Parameters:
ivyNotations- Stubs to download in Ivy notations.- Returns:
- the rule
-
withStubPerConsumer
- Parameters:
stubPerConsumer- Allows stub per consumer.- Returns:
- the rule
-
withConsumerName
- Parameters:
consumerName- given consumer name- Returns:
- the rule
-
withMappingsOutputFolder
- Parameters:
mappingsOutputFolder- Allows setting the output folder for mappings- Returns:
- the rule
-
withDeleteStubsAfterTest
- Parameters:
deleteStubsAfterTest- If set tofalsewill NOT delete stubs from a temporary folder after running tests- Returns:
- the rule
-
withGenerateStubs
- Parameters:
generateStubs- If set totruewill NOT load generated stubs but will generate stubs from contract definitions at runtime.- Returns:
- the rule
-
failOnNoStubs
- Parameters:
failOnNoStubs- when enabled, this flag will tell stub runner to throw an exception when no stubs / contracts were found.- Returns:
- the rule
-
withProperties
- Parameters:
properties- Map of properties that can be passed to customStubDownloaderBuilder- Returns:
- the rule
-
withHttpServerStubConfigurer
StubRunnerRule withHttpServerStubConfigurer(Class<? extends HttpServerStubConfigurer> httpServerStubConfigurer) - Parameters:
httpServerStubConfigurer- Configuration for an HTTP server stub- Returns:
- the rule
-