is not current version
Last Version 3.5.24

au.com.dius:pact-jvm-provider-gradle_2.11 2.0.1

pact-jvm-provider-gradle ======================== Gradle plugin for verifying pacts against a provider. The Gradle plugin creates a task `pactVerify` to your build which will verify all configured pacts against your provider. ## To Use It ### 1. Add the pact-jvm-provider-gradle jar file to your build script class path: ```groovy buildscript { repositories { mavenCentral() } dependencies { classpath 'au.com.dius:pact-jvm-provider-gradle_2.10:2.0.1' } } ``` ### 2. Apply the pact plugin ```groovy apply plugin: 'pact' ``` ### 3. Define the pacts between your consumers and providers ```groovy pact { serviceProviders { // You can define as many as you need, but each must have a unique name provider1 { // All the provider properties are optional, and have sensible defaults (shown below) protocol = 'http' host = 'localhost' port = 8080 path = '/' // Again, you can define as many consumers for each provider as you need, but each must have a unique name hasPactWith('consumer1') { // currenty supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ### 4. Execute `gradle pactVerify` ## Starting and shutting down your provider If you need to start-up or shutdown your provider, you can define a start and terminate task for each provider. You could use the jetty tasks here if you provider is built as a WAR file. ```groovy // This will be called before the provider task task('startTheApp') << { // start up your provider here } // This will be called after the provider task task('killTheApp') << { // kill your provider here } pact { serviceProviders { provider1 { startProviderTask = startTheApp terminateProviderTask = killTheApp hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` Following typical Gradle behaviour, you can set the provider task properties to the actual tasks, or to the task names as a string (for the case when they haven't been defined yet). ## Project Properties The following project properties can be specified with `-Pproperty=value` on the command line: |Property|Description| |--------|-----------| |pact.showStacktrace|This turns on stacktrace printing for each request. It can help with diagnosing network errors| ## Provider States For each provider you can specify a state change URL to use to switch the state of the provider. This URL will receive the providerState description from the pact file before each interaction via a POST. ``` pact { serviceProviders { provider1 { hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') stateChange = url('http://localhost:8001/tasks/pactStateChange') stateChangeUsesBody = false // defaults to true } } } } ``` If the `stateChangeUsesBody` is not specified, or is set to true, then the provider state description will be sent as JSON in the body of the request. If it is set to false, it will passed as a query parameter.

Categories

Categories

IDE Development Tools Gradle Build Tools
GroupId

GroupId

au.com.dius
ArtifactId

ArtifactId

pact-jvm-provider-gradle_2.11
Version

Version

2.0.1
Type

Type

jar

Download pact-jvm-provider-gradle_2.11 2.0.1


<!-- https://jarcasting.com/artifacts/au.com.dius/pact-jvm-provider-gradle_2.11/ -->
<dependency>
    <groupId>au.com.dius</groupId>
    <artifactId>pact-jvm-provider-gradle_2.11</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/au.com.dius/pact-jvm-provider-gradle_2.11/
implementation 'au.com.dius:pact-jvm-provider-gradle_2.11:2.0.1'
// https://jarcasting.com/artifacts/au.com.dius/pact-jvm-provider-gradle_2.11/
implementation ("au.com.dius:pact-jvm-provider-gradle_2.11:2.0.1")
'au.com.dius:pact-jvm-provider-gradle_2.11:jar:2.0.1'
<dependency org="au.com.dius" name="pact-jvm-provider-gradle_2.11" rev="2.0.1">
  <artifact name="pact-jvm-provider-gradle_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='au.com.dius', module='pact-jvm-provider-gradle_2.11', version='2.0.1')
)
libraryDependencies += "au.com.dius" % "pact-jvm-provider-gradle_2.11" % "2.0.1"
[au.com.dius/pact-jvm-provider-gradle_2.11 "2.0.1"]