Class SelectorBuilder
-
- All Implemented Interfaces:
public class SelectorBuilderBuilder for setting up consumer version selectors in provider JUnit tests. See https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors
-
-
Constructor Summary
Constructors Constructor Description SelectorBuilder()
-
Method Summary
Modifier and Type Method Description final List<ConsumerVersionSelectors>getSelectors()final SelectorBuildermainBranch()The latest version from the main branch of each consumer, as specified by the consumer's mainBranch property. final SelectorBuilderbranch(String name, String consumer, String fallback)The latest version from a particular branch of each consumer, or for a particular consumer if the second parameter is provided. final SelectorBuilderbranch(String name, String consumer)The latest version from a particular branch of each consumer, or for a particular consumer if the second parameter is provided. final SelectorBuilderbranch(String name)The latest version from a particular branch of each consumer, or for a particular consumer if the second parameter is provided. final SelectorBuilderdeployedOrReleased()All the currently deployed and currently released and supported versions of each consumer. final SelectorBuildermatchingBranch()The latest version from any branch of the consumer that has the same name as the current branch of the provider. final SelectorBuilderdeployedTo(String environment)Any versions currently deployed to the specified environment final SelectorBuilderreleasedTo(String environment)Any versions currently released and supported in the specified environment final SelectorBuilderenvironment(String environment)any versions currently deployed or released and supported in the specified environment final SelectorBuildertag(String name)All versions with the specified tag final SelectorBuilderlatestTag(String name)The latest version for each consumer with the specified tag final SelectorBuilderselector(String tagName, Boolean latest, String fallbackTag, String consumer)Generic selector. final SelectorBuilderrawSelectorJson(String json)Selector in raw JSON form. final List<ConsumerVersionSelectors>build()Construct the final list of consumer version selectors -
-
Method Detail
-
getSelectors
final List<ConsumerVersionSelectors> getSelectors()
-
mainBranch
final SelectorBuilder mainBranch()
The latest version from the main branch of each consumer, as specified by the consumer's mainBranch property.
-
branch
@JvmOverloads() final SelectorBuilder branch(String name, String consumer, String fallback)
The latest version from a particular branch of each consumer, or for a particular consumer if the second parameter is provided. If fallback is provided, falling back to the fallback branch if none is found from the specified branch.
- Parameters:
name-Branch name
consumer-Consumer name (optional)
fallback-Fall back to this branch if none is found from the specified branch (optional)
-
branch
@JvmOverloads() final SelectorBuilder branch(String name, String consumer)
The latest version from a particular branch of each consumer, or for a particular consumer if the second parameter is provided. If fallback is provided, falling back to the fallback branch if none is found from the specified branch.
- Parameters:
name-Branch name
consumer-Consumer name (optional)
-
branch
@JvmOverloads() final SelectorBuilder branch(String name)
The latest version from a particular branch of each consumer, or for a particular consumer if the second parameter is provided. If fallback is provided, falling back to the fallback branch if none is found from the specified branch.
- Parameters:
name-Branch name
-
deployedOrReleased
final SelectorBuilder deployedOrReleased()
All the currently deployed and currently released and supported versions of each consumer.
-
matchingBranch
final SelectorBuilder matchingBranch()
The latest version from any branch of the consumer that has the same name as the current branch of the provider. Used for coordinated development between consumer and provider teams using matching feature branch names.
-
deployedTo
final SelectorBuilder deployedTo(String environment)
Any versions currently deployed to the specified environment
-
releasedTo
final SelectorBuilder releasedTo(String environment)
Any versions currently released and supported in the specified environment
-
environment
final SelectorBuilder environment(String environment)
any versions currently deployed or released and supported in the specified environment
-
tag
final SelectorBuilder tag(String name)
All versions with the specified tag
-
latestTag
final SelectorBuilder latestTag(String name)
The latest version for each consumer with the specified tag
-
selector
@Deprecated(message = "Tags are deprecated in favor of branches", replaceWith = @ReplaceWith(imports = {}, expression = "branch")) final SelectorBuilder selector(String tagName, Boolean latest, String fallbackTag, String consumer)
Generic selector.
With just the tag name, returns all versions with the specified tag.
With latest, returns the latest version for each consumer with the specified tag.
With a fallback tag, returns the latest version for each consumer with the specified tag, falling back to the fallbackTag if non is found with the specified tag.
With a consumer name, returns the latest version for a specified consumer with the specified tag.
With only latest, returns the latest version for each consumer. NOT RECOMMENDED as it suffers from race conditions when pacts are published from multiple branches.
-
rawSelectorJson
final SelectorBuilder rawSelectorJson(String json)
Selector in raw JSON form.
-
-
-
-