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

public static class StubRunnerRule.PortStubRunnerRule extends StubRunnerRule
Helper class with additional port, related methods once you pick a stub to download.
Since:
1.2.0
  • Method Details

    • withPort

      public StubRunnerRule withPort(Integer port)
    • messageVerifierSender

      StubRunnerRule messageVerifierSender(org.springframework.cloud.contract.verifier.messaging.MessageVerifierSender messageVerifier)
      Pass the MessageVerifierSender 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.
      Parameters:
      messageVerifier - message verifier implementation
      Returns:
      the rule
    • messageVerifierReceiver

      StubRunnerRule messageVerifierReceiver(org.springframework.cloud.contract.verifier.messaging.MessageVerifierReceiver messageVerifier)
      Pass the MessageVerifierReceiver 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.
      Parameters:
      messageVerifier - message verifier implementation
      Returns:
      the rule
    • options

      StubRunnerRule options(StubRunnerOptions stubRunnerOptions)
      Override all options.
      Parameters:
      stubRunnerOptions - options of Stub Runner
      Returns:
      the rule
      See Also:
    • minPort

      StubRunnerRule minPort(int minPort)
      Parameters:
      minPort - min value of port for WireMock server
      Returns:
      the rule
    • maxPort

      StubRunnerRule maxPort(int maxPort)
      Parameters:
      maxPort - max value of port for WireMock server
      Returns:
      the rule
    • repoRoot

      StubRunnerRule repoRoot(String 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 stub
      artifactId - artifact id of the stub
      version - version of the stub
      classifier - 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 stub
      artifactId - artifact id of the stub
      classifier - 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 stub
      artifactId - artifact id of the stub
      version - 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 stub
      artifactId - 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

      StubRunnerRule downloadStubs(String... ivyNotations)
      Parameters:
      ivyNotations - Stubs to download in Ivy notations.
      Returns:
      the rule
    • downloadStubs

      StubRunnerRule downloadStubs(List<String> ivyNotations)
      Parameters:
      ivyNotations - Stubs to download in Ivy notations.
      Returns:
      the rule
    • withStubPerConsumer

      StubRunnerRule withStubPerConsumer(boolean stubPerConsumer)
      Parameters:
      stubPerConsumer - Allows stub per consumer.
      Returns:
      the rule
    • withConsumerName

      StubRunnerRule withConsumerName(String consumerName)
      Parameters:
      consumerName - given consumer name
      Returns:
      the rule
    • withMappingsOutputFolder

      StubRunnerRule withMappingsOutputFolder(String mappingsOutputFolder)
      Parameters:
      mappingsOutputFolder - Allows setting the output folder for mappings
      Returns:
      the rule
    • withDeleteStubsAfterTest

      StubRunnerRule withDeleteStubsAfterTest(boolean deleteStubsAfterTest)
      Parameters:
      deleteStubsAfterTest - If set to false will NOT delete stubs from a temporary folder after running tests
      Returns:
      the rule
    • withGenerateStubs

      StubRunnerRule withGenerateStubs(boolean generateStubs)
      Parameters:
      generateStubs - If set to true will NOT load generated stubs but will generate stubs from contract definitions at runtime.
      Returns:
      the rule
    • failOnNoStubs

      StubRunnerRule failOnNoStubs(boolean 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

      StubRunnerRule withProperties(Map<String,String> properties)
      Parameters:
      properties - Map of properties that can be passed to custom StubDownloaderBuilder
      Returns:
      the rule
    • withHttpServerStubConfigurer

      StubRunnerRule withHttpServerStubConfigurer(Class<? extends HttpServerStubConfigurer> httpServerStubConfigurer)
      Parameters:
      httpServerStubConfigurer - Configuration for an HTTP server stub
      Returns:
      the rule