Annotation Type AutoConfigureStubRunner


@Target(TYPE) @Retention(RUNTIME) @Documented @ImportAutoConfiguration @AutoConfigureMessageVerifier @PropertyMapping(value="stubrunner", skip=ON_DEFAULT_VALUE) public @interface AutoConfigureStubRunner
Author:
Dave Syer
  • Element Details

    • minPort

      int minPort
      Returns:
      Min value of a port for the automatically started WireMock server.
      Default:
      10000
    • maxPort

      int maxPort
      Returns:
      Max value of a port for the automatically started WireMock server.
      Default:
      15000
    • repositoryRoot

      String repositoryRoot
      Returns:
      The repository root to use (where the stubs should be downloaded from).
      Default:
      ""
    • ids

      String[] ids
      Returns:
      The ids of the stubs to run in "ivy" notation ([groupId]:artifactId[:version][:classifier][:port]). groupId, version, classifier and port can be optional.
      Default:
      {}
    • classifier

      String classifier
      Returns:
      The classifier to use by default in ivy co-ordinates for a stub.
      Default:
      "stubs"
    • stubsPerConsumer

      boolean stubsPerConsumer
      On the producer side the consumers can have a folder that contains contracts related only to them. By setting the flag to true we no longer register all stubs but only those that correspond to the consumer application's name. In other words we'll scan the path of every stub and if it contains the name of the consumer in the path only then will it get registered. Let's look at this example. Let's assume that we have a producer called foo and two consumers baz and bar. On the foo producer side the contracts would look like this src/test/resources/contracts/baz-service/some/contracts/... and src/test/resources/contracts/bar-service/some/contracts/.... Then when the consumer with spring.application.name or the consumerName() annotation parameter set to baz-service will define the test setup as follows @AutoConfigureStubRunner(ids = "com.example:foo:+:stubs:8095", stubsPerConsumer=true) then only the stubs registered under src/test/resources/contracts/baz-service/some/contracts/... will get registered and those under src/test/resources/contracts/bar-service/some/contracts/... will get ignored.
      Returns:
      true to turn on the feature
      See Also:
      Default:
      false
    • consumerName

      String consumerName
      You can override the default spring.application.name of this field by setting a value to this parameter.
      Returns:
      name of this application
      See Also:
      Default:
      ""
    • mappingsOutputFolder

      String mappingsOutputFolder
      For debugging purposes you can output the registered mappings to a given folder. Each HTTP server stub will have its own subfolder where all the mappings will get stored.
      Returns:
      where the mappings output should be stored
      See Also:
      Default:
      ""
    • stubsMode

      The way stubs should be found and registered. Defaults to StubRunnerProperties.StubsMode.CLASSPATH.
      Returns:
      the type of stubs mode
      Default:
      CLASSPATH
    • properties

      String[] properties
      Properties in form key=value.
      Returns:
      the properties to add
      Default:
      {}
    • deleteStubsAfterTest

      boolean deleteStubsAfterTest
      Returns:
      If set to false will NOT delete stubs from a temporary folder after running tests
      Default:
      true
    • generateStubs

      boolean generateStubs
      Returns:
      When enabled, this flag will tell stub runner to not load the generated stubs, but convert the found contracts at runtime to a stub format and run those stubs.
      Default:
      false
    • failOnNoStubs

      boolean failOnNoStubs
      Returns:
      when enabled, this flag will tell stub runner to throw an exception when no stubs / contracts were found.
      Default:
      true
    • httpServerStubConfigurer

      Class<? extends HttpServerStubConfigurer> httpServerStubConfigurer
      Configuration for an HTTP server stub.
      Returns:
      class that allows to perform additional HTTP server stub configuration
      Default:
      org.springframework.cloud.contract.stubrunner.HttpServerStubConfigurer.NoOpHttpServerStubConfigurer.class