-
- All Implemented Interfaces:
-
au.com.dius.pact.core.pactbroker.IPactBrokerClient
public class PactBrokerClient implements IPactBrokerClient
Client for the pact broker service
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPactBrokerClient.Companion
-
Field Summary
Fields Modifier and Type Field Description private final StringpactBrokerUrlprivate final Map<String, Object>optionsprivate final PactBrokerClientConfigconfig
-
Constructor Summary
Constructors Constructor Description PactBrokerClient(String pactBrokerUrl)PactBrokerClient(String pactBrokerUrl, Map<String, Object> options, PactBrokerClientConfig config)
-
Method Summary
Modifier and Type Method Description List<PactBrokerResult>fetchConsumers(String provider)Fetches all consumers for the given provider List<PactBrokerResult>fetchConsumersWithTag(String provider, String tag)Fetches all consumers for the given provider and tag Result<List<PactBrokerResult>, Exception>fetchConsumersWithSelectors(String providerName, List<ConsumerVersionSelector> selectors, List<String> providerTags, Boolean enablePending, String includeWipPactsSince)Fetches all consumers for the given provider and selectors Result<String, Exception>uploadPactFile(File pactFile, String version, List<String> tags)Uploads the given pact file to the broker, and optionally applies any tags StringgetUrlForProvider(String providerName, String tag)PactResponsefetchPact(String url, Boolean encodePath)IHalClientnewHalClient()Result<Boolean, String>publishVerificationResults(Map<String, Object> docAttributes, TestResult result, String version)Publishes the result to the "pb:publish-verification-results" link in the document attributes. Result<Boolean, String>publishVerificationResults(Map<String, Object> docAttributes, TestResult result, String version, String buildUrl)Publishes the result to the "pb:publish-verification-results" link in the document attributes. final JsonValue.ObjectbuildPayload(TestResult result, String version, String buildUrl)List<PactBrokerResult>fetchLatestConsumersWithNoTag(String provider)Fetches the consumers of the provider that have no associated tag final UnitpublishProviderTag(Map<String, Object> docAttributes, String name, String tag, String version)Result<Boolean, List<String>>publishProviderTags(Map<String, Object> docAttributes, String name, List<String> tags, String version)Publish all the tags for the provider to the Pact broker CanIDeployResultcanIDeploy(String pacticipant, String pacticipantVersion, Latest latest, String to)Result<String, Exception>createVersionTag(String pacticipant, String pacticipantVersion, String tag)final StringgetPactBrokerUrl()Map<String, Object>getOptions()final PactBrokerClientConfiggetConfig()-
-
Method Detail
-
fetchConsumers
@Deprecated(message = "Use the version that takes selectors instead", replaceWith = @ReplaceWith(imports = {}, expression = "fetchConsumersWithSelectors")) List<PactBrokerResult> fetchConsumers(String provider)
Fetches all consumers for the given provider
-
fetchConsumersWithTag
@Deprecated(message = "Use fetchConsumersWithSelectors") List<PactBrokerResult> fetchConsumersWithTag(String provider, String tag)
Fetches all consumers for the given provider and tag
-
fetchConsumersWithSelectors
Result<List<PactBrokerResult>, Exception> fetchConsumersWithSelectors(String providerName, List<ConsumerVersionSelector> selectors, List<String> providerTags, Boolean enablePending, String includeWipPactsSince)
Fetches all consumers for the given provider and selectors
-
uploadPactFile
@JvmOverloads() Result<String, Exception> uploadPactFile(File pactFile, String version, List<String> tags)
Uploads the given pact file to the broker, and optionally applies any tags
-
getUrlForProvider
String getUrlForProvider(String providerName, String tag)
-
fetchPact
PactResponse fetchPact(String url, Boolean encodePath)
-
newHalClient
IHalClient newHalClient()
-
publishVerificationResults
Result<Boolean, String> publishVerificationResults(Map<String, Object> docAttributes, TestResult result, String version)
Publishes the result to the "pb:publish-verification-results" link in the document attributes.
-
publishVerificationResults
Result<Boolean, String> publishVerificationResults(Map<String, Object> docAttributes, TestResult result, String version, String buildUrl)
Publishes the result to the "pb:publish-verification-results" link in the document attributes.
-
buildPayload
final JsonValue.Object buildPayload(TestResult result, String version, String buildUrl)
-
fetchLatestConsumersWithNoTag
@Deprecated(message = "Use the version that takes selectors instead", replaceWith = @ReplaceWith(imports = {}, expression = "fetchConsumersWithSelectors")) List<PactBrokerResult> fetchLatestConsumersWithNoTag(String provider)
Fetches the consumers of the provider that have no associated tag
-
publishProviderTag
@Deprecated(message = "Use publishProviderTags", replaceWith = @ReplaceWith(imports = {}, expression = "publishProviderTags")) final Unit publishProviderTag(Map<String, Object> docAttributes, String name, String tag, String version)
-
publishProviderTags
Result<Boolean, List<String>> publishProviderTags(Map<String, Object> docAttributes, String name, List<String> tags, String version)
Publish all the tags for the provider to the Pact broker
- Parameters:
docAttributes- Attributes associated with the fetched Pact filetags- Provider tags to tag the provider withversion- Provider version
-
canIDeploy
CanIDeployResult canIDeploy(String pacticipant, String pacticipantVersion, Latest latest, String to)
-
createVersionTag
Result<String, Exception> createVersionTag(String pacticipant, String pacticipantVersion, String tag)
-
getPactBrokerUrl
final String getPactBrokerUrl()
-
getOptions
Map<String, Object> getOptions()
-
getConfig
final PactBrokerClientConfig getConfig()
-
-
-
-