Common Properties

对于常见属性,可以使用系统属性或 Spring 配置属性来设置,包括端口最小值、最大值、存储库根目录、存根模式、存根 ID、凭据和是否为每个消费者使用不同的存根。

对于存根 ID,可以通过 stubrunner.ids 系统属性指定,采用 groupId:artifactId:version:classifier:port 的格式,其中 version、classifier 和 port 为可选参数。

本部分简单介绍了常见属性,包括:

This section briefly describes common properties, including:

Common Properties for JUnit and Spring

您可以使用系统属性或 Spring 配置属性设置重复的属性。下表显示了它们的名称及其默认值:

You can set repetitive properties by using system properties or Spring configuration properties. The following table shows their names with their default values:

Property name Default value Description

stubrunner.minPort

10000

Minimum value of a port for a started WireMock with stubs.

stubrunner.maxPort

15000

Maximum value of a port for a started WireMock with stubs.

stubrunner.repositoryRoot

Maven repository URL. If blank, then call the local Maven repo.

stubrunner.classifier

stubs

Default classifier for the stub artifacts.

stubrunner.stubsMode

CLASSPATH

The way you want to fetch and register the stubs.

stubrunner.ids

Array of Ivy notation stubs to download.

stubrunner.username

Optional username to access the tool that stores the JARs with stubs.

stubrunner.password

Optional password to access the tool that stores the JARs with stubs.

stubrunner.stubsPerConsumer

false

Set to true if you want to use different stubs for each consumer instead of registering all stubs for every consumer.

stubrunner.consumerName

If you want to use a stub for each consumer and want to override the consumer name, change this value.

Stub Runner Stubs IDs

您可以在 stubrunner.ids 系统属性中设置要下载的存根。它们采用以下模式:

You can set the stubs to download in the stubrunner.ids system property. They use the following pattern:

groupId:artifactId:version:classifier:port

请注意,versionclassifierport 是可选的。

Note that version, classifier, and port are optional.

  • If you do not provide the port, a random one is picked.

  • If you do not provide the classifier, the default is used. (Note that you can pass an empty classifier this way: groupId:artifactId:version:).

  • If you do not provide the version, then + is passed, and the latest one is downloaded.

port 表示 WireMock 服务器的端口。

port means the port of the WireMock server.

从 1.0.4 版本开始,您可以提供您希望 Stub Runner 考虑的一系列版本。您可以在 here 中阅读有关 Aether 版本范围的更多信息。

Starting with version 1.0.4, you can provide a range of versions that you would like the Stub Runner to take into consideration. You can read more about the Aether versioning ranges here.