Class 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 Detail

      • messageVerifier

        public abstract StubRunnerRule messageVerifier​(org.springframework.cloud.contract.verifier.messaging.MessageVerifier messageVerifier)
        Pass the 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.
        Parameters:
        messageVerifier - message verifier implementation
        Returns:
        the rule
      • minPort

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

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

        public abstract StubRunnerRule repoRoot​(String repoRoot)
        Parameters:
        repoRoot - String URI of repository containing stubs
        Returns:
        the rule
      • downloadStub

        public abstract 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

        public abstract 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

        public abstract 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

        public abstract 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

        public abstract 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

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

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

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

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

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

        public abstract 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

        public abstract 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

        public abstract 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
      • withHttpServerStubConfigurer

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