All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Download all versions of pact-jvm-provider-gradle_2.10 JAR files with all dependencies

Search JAR files by class name

pact-jvm-provider-gradle_2.10 from group au.com.dius (version 2.2.10)

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 ### For Gradle versions prior to 2.1 #### 1.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.2.1' } } ``` #### 1.2. Apply the pact plugin ```groovy apply plugin: 'au.com.dius.pact' ``` ### For Gradle versions 2.1+ ```groovy plugins { id "au.com.dius.pact" version "2.2.1" } ``` ### 2. 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') { // currently supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } // Or if you have many pact files in a directory hasPactsWith('manyConsumers') { // Will define a consumer for each pact file in the directory. // Consumer name is read from contents of pact file pactFileLocation = file('path/to/pacts') } } } } ``` ### 3. Execute `gradle pactVerify` ## Specifying the provider hostname at runtime If you need to calculate the provider hostname at runtime, you can give a Closure as the provider host. ```groovy pact { serviceProviders { provider1 { host = { lookupHostName() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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). ## Enabling insecure SSL [version 2.2.8+] For providers that are running on SSL with self-signed certificates, you need to enable insecure SSL mode by setting `insecure = true` on the provider. ```groovy pact { serviceProviders { provider1 { insecure = true // allow SSL with a self-signed cert hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## Specifying a custom trust store [version 2.2.8+] For environments that are running their own certificate chains: ```groovy pact { serviceProviders { provider1 { trustStore = new File('relative/path/to/trustStore.jks') trustStorePassword = 'changeit' hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } `trustStore` is either relative to the current working (build) directory. `trustStorePassword` defaults to `changeit`. NOTE: The hostname will still be verified against the certificate. ## Modifying the HTTP Client Used [version 2.2.4+] The default HTTP client is used for all requests to providers (created with a call to `HttpClients.createDefault()`). This can be changed by specifying a closure assigned to createClient on the provider that returns a CloseableHttpClient. For example: ```groovy pact { serviceProviders { provider1 { createClient = { provider -> // This will enable the client to accept self-signed certificates HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()) .setSslcontext(new SSLContextBuilder().loadTrustMaterial(null, { x509Certificates, s -> true }) .build()) .build() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## Modifying the requests before they are sent **NOTE on breaking change: Version 2.1.8+ uses Apache HttpClient instead of HttpBuilder so the closure will receive a HttpRequest object instead of a request Map.** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Pact Gradle plugin provides a request filter that can be set to a closure on the provider that will be called before the request is made. This closure will receive the HttpRequest prior to it being executed. ```groovy pact { serviceProviders { provider1 { requestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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| |pact.filter.consumers|Comma seperated list of consumer names to verify| |pact.filter.description|Only verify interactions whose description match the provided regular expression| |pact.filter.providerState|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state| ## Provider States For a description of what provider states are, see the wiki in the Ruby project: https://github.com/realestate-com-au/pact/wiki/Provider-states ### Using a state change URL 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. As for normal requests, a request filter (`stateChangeRequestFilter`) can also be set to manipulate the request before it is sent. ```groovy 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 stateChangeRequestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } } // or hasPactsWith('consumers') { pactFileLocation = file('path/to/pacts') 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. ### Using a Closure [version 2.2.2+] You can set a closure to be called before each verification with a defined provider state. The closure will be called with the state description from the pact file. ```groovy pact { serviceProviders { provider1 { hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') // Load a fixture file based on the provider state and then setup some database // data. Does not require a state change request so returns false stateChange = { providerState -> def fixture = loadFixtuerForProviderState(providerState) setupDatabase(fixture) } } } } } ``` ## Filtering the interactions that are verified You can filter the interactions that are run using three project properties: `pact.filter.consumers`, `pact.filter.description` and `pact.filter.providerState`. Adding `-Ppact.filter.consumers=consumer1,consumer2` to the command line will only run the pact files for those consumers (consumer1 and consumer2). Adding `-Ppact.filter.description=a request for payment.*` will only run those interactions whose descriptions start with 'a request for payment'. `-Ppact.filter.providerState=.*payment` will match any interaction that has a provider state that ends with payment, and `-Ppact.filter.providerState=` will match any interaction that does not have a provider state. ## Publishing to the Gradle Community Portal To publish the plugin to the community portal: $ ./gradlew :pact-jvm-provider-gradle_2.11:publishPlugins # Publishing pact files to a pact broker *[version 2.2.7+]* The pact gradle plugin provides a `pactPublish` task that can publish all pact files in a directory to a pact broker. To use it, you need to add a publish configuration to the pact configuration that defines the directory where the pact files are and the URL to the pact broker. For example: ```groovy pact { publish { pactDirectory = '/pact/dir' // defaults to $buildDir/pacts pactBrokerUrl = 'http://pactbroker:1234' } } ```

Group: au.com.dius Artifact: pact-jvm-provider-gradle_2.10
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-provider-gradle_2.10
Group au.com.dius
Version 2.2.10
Last update 25. July 2015
Tags: showstacktrace need requestfilter using passed store calculate supports creates plugin matches defaults pactstatechange truststorepassword providers created stacktrace these oauth defined host ends contents httpclients shown loadfixtuerforproviderstate header starttheapp project defines load each specify examples diagnosing lookuphostname serviceproviders unique give specifying before data made states setupdatabase seperated running executed life could loadtrustmaterial current publishplugins noophostnameverifier publish shutdown https define payment trust consumer1 either ppact pactbrokerurl what consumer2 string down configuration publishing expression body client change httpclient mavencentral normal apache jetty consumer must localhost descriptions after would description optional pactpublish execute comma whose environments haspactwith hostname script that statechange changeit names against require case example span does terminate ruby setsslcontext setting following setsslhostnameverifier httpbuilder json name provider1 interactions protocol regular community assigned provides 8080 provider still which authentication provided actual adding statechangerequestfilter github pacts httprequest terminateprovidertask they filtering configured verify accept insecure modifying help certificate errors file verified empty false only tokens working startprovidertask groovy sslcontextbuilder again interaction pactfile truststore many builddir sensible haspactswith enabling x509certificates verification start http then will closure some small port realestate repositories plugins query line switch self build providerstate version mode typical cert dependencies command starting wiki built note "null" files post signed killtheapp haven persisted true specified directory pactfilelocation broker based apply sometimes being enable kill gradle_2 authorization used where been changed prior requests sent shutting request when statechangeusesbody closeablehttpclient value three pactbroker returns custom portal consumers class here buildscript property printing properties pactdirectory relative classpath 1234 default pact called gradle createdefault match this addheader filter call fixture allow verifying have behaviour state runtime currently manipulate object from turns network pactverify parameter setup path below read receive between certificates gradlew with those task chains your createclient list tasks eyjhbgcioijsuzi1niisimn0esi6imfw database pproperty versions 8001 instead uses manyconsumers things their also breaking dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 6
Dependencies scala-library, http-builder, slf4j-api, json4s-native_2.10, json4s-jackson_2.10, pact-jvm-provider_2.10,
There are maybe transitive dependencies!

pact-jvm-provider-gradle_2.10 from group au.com.dius (version 2.2.9)

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 ### For Gradle versions prior to 2.1 #### 1.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.2.1' } } ``` #### 1.2. Apply the pact plugin ```groovy apply plugin: 'au.com.dius.pact' ``` ### For Gradle versions 2.1+ ```groovy plugins { id "au.com.dius.pact" version "2.2.1" } ``` ### 2. 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') { // currently supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } // Or if you have many pact files in a directory hasPactsWith('manyConsumers') { // Will define a consumer for each pact file in the directory. // Consumer name is read from contents of pact file pactFileLocation = file('path/to/pacts') } } } } ``` ### 3. Execute `gradle pactVerify` ## Specifying the provider hostname at runtime If you need to calculate the provider hostname at runtime, you can give a Closure as the provider host. ```groovy pact { serviceProviders { provider1 { host = { lookupHostName() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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). ## Enabling insecure SSL [version 2.2.8+] For providers that are running on SSL with self-signed certificates, you need to enable insecure SSL mode by setting `insecure = true` on the provider. ```groovy pact { serviceProviders { provider1 { insecure = true // allow SSL with a self-signed cert hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## Specifying a custom trust store [version 2.2.8+] For environments that are running their own certificate chains: ```groovy pact { serviceProviders { provider1 { trustStore = new File('relative/path/to/trustStore.jks') trustStorePassword = 'changeit' hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } `trustStore` is either relative to the current working (build) directory. `trustStorePassword` defaults to `changeit`. NOTE: The hostname will still be verified against the certificate. ## Modifying the HTTP Client Used [version 2.2.4+] The default HTTP client is used for all requests to providers (created with a call to `HttpClients.createDefault()`). This can be changed by specifying a closure assigned to createClient on the provider that returns a CloseableHttpClient. For example: ```groovy pact { serviceProviders { provider1 { createClient = { provider -> // This will enable the client to accept self-signed certificates HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()) .setSslcontext(new SSLContextBuilder().loadTrustMaterial(null, { x509Certificates, s -> true }) .build()) .build() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## Modifying the requests before they are sent **NOTE on breaking change: Version 2.1.8+ uses Apache HttpClient instead of HttpBuilder so the closure will receive a HttpRequest object instead of a request Map.** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Pact Gradle plugin provides a request filter that can be set to a closure on the provider that will be called before the request is made. This closure will receive the HttpRequest prior to it being executed. ```groovy pact { serviceProviders { provider1 { requestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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| |pact.filter.consumers|Comma seperated list of consumer names to verify| |pact.filter.description|Only verify interactions whose description match the provided regular expression| |pact.filter.providerState|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state| ## Provider States For a description of what provider states are, see the wiki in the Ruby project: https://github.com/realestate-com-au/pact/wiki/Provider-states ### Using a state change URL 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. As for normal requests, a request filter (`stateChangeRequestFilter`) can also be set to manipulate the request before it is sent. You can also give a Closure for the stateChange that returns the URL. ```groovy 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 stateChangeRequestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } } // or hasPactsWith('consumers') { pactFileLocation = file('path/to/pacts') 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. ### Using a Closure [version 2.2.2+] You can set a closure to be called before each verification with a defined provider state. The closure will be called with the state description from the pact file. If you also require the state change request to be executed, return the URL for the request (as a URL, URI or String) from the closure. Otherwise, return null or false. ```groovy pact { serviceProviders { provider1 { hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') // Load a fixture file based on the provider state and then setup some database // data. Does not require a state change request so returns false stateChange = { providerState -> def fixture = loadFixtuerForProviderState(providerState) setupDatabase(fixture) false } } } } } ``` ## Filtering the interactions that are verified You can filter the interactions that are run using three project properties: `pact.filter.consumers`, `pact.filter.description` and `pact.filter.providerState`. Adding `-Ppact.filter.consumers=consumer1,consumer2` to the command line will only run the pact files for those consumers (consumer1 and consumer2). Adding `-Ppact.filter.description=a request for payment.*` will only run those interactions whose descriptions start with 'a request for payment'. `-Ppact.filter.providerState=.*payment` will match any interaction that has a provider state that ends with payment, and `-Ppact.filter.providerState=` will match any interaction that does not have a provider state. ## Publishing to the Gradle Community Portal To publish the plugin to the community portal: $ ./gradlew :pact-jvm-provider-gradle_2.11:publishPlugins # Publishing pact files to a pact broker *[version 2.2.7+]* The pact gradle plugin provides a `pactPublish` task that can publish all pact files in a directory to a pact broker. To use it, you need to add a publish configuration to the pact configuration that defines the directory where the pact files are and the URL to the pact broker. For example: ```groovy pact { publish { pactDirectory = '/pact/dir' // defaults to $buildDir/pacts pactBrokerUrl = 'http://pactbroker:1234' } } ```

Group: au.com.dius Artifact: pact-jvm-provider-gradle_2.10
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-provider-gradle_2.10
Group au.com.dius
Version 2.2.9
Last update 13. July 2015
Tags: showstacktrace need requestfilter using passed store calculate supports creates plugin matches defaults pactstatechange truststorepassword providers created stacktrace these oauth defined host ends contents httpclients shown loadfixtuerforproviderstate header starttheapp project defines load each specify examples diagnosing lookuphostname serviceproviders unique give specifying before data made states setupdatabase seperated running executed life could loadtrustmaterial current publishplugins noophostnameverifier publish shutdown https define payment trust consumer1 either ppact pactbrokerurl what consumer2 string down configuration publishing expression body client change httpclient mavencentral normal apache jetty consumer must localhost descriptions after would description optional pactpublish execute comma whose environments haspactwith hostname script that statechange changeit names against require case example span does terminate ruby setsslcontext setting following setsslhostnameverifier httpbuilder json name provider1 interactions protocol regular community assigned provides 8080 provider still which authentication provided actual adding statechangerequestfilter github pacts httprequest terminateprovidertask they filtering configured verify accept otherwise insecure modifying help certificate errors file verified empty false only tokens working startprovidertask groovy sslcontextbuilder again interaction pactfile truststore many builddir sensible haspactswith enabling x509certificates verification start http then will closure some small port realestate repositories plugins query line switch self build providerstate version mode typical cert dependencies command starting wiki built "null" note files post signed killtheapp haven return persisted true specified directory pactfilelocation broker based apply sometimes being enable kill gradle_2 authorization used where been changed prior requests sent shutting request when statechangeusesbody closeablehttpclient value three pactbroker returns custom portal consumers class here buildscript property printing properties pactdirectory relative classpath 1234 default pact called gradle createdefault match this addheader filter call fixture allow verifying have behaviour state runtime currently manipulate object from turns network pactverify parameter setup path below read receive between certificates gradlew with those task chains your createclient list tasks eyjhbgcioijsuzi1niisimn0esi6imfw database pproperty versions 8001 instead uses manyconsumers things their also breaking dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 6
Dependencies scala-library, pact-jvm-provider_2.10, http-builder, slf4j-api, json4s-native_2.10, json4s-jackson_2.10,
There are maybe transitive dependencies!

pact-jvm-provider-gradle_2.10 from group au.com.dius (version 2.2.8)

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 ### For Gradle versions prior to 2.1 #### 1.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.2.1' } } ``` #### 1.2. Apply the pact plugin ```groovy apply plugin: 'au.com.dius.pact' ``` ### For Gradle versions 2.1+ ```groovy plugins { id "au.com.dius.pact" version "2.2.1" } ``` ### 2. 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') { // currently supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } // Or if you have many pact files in a directory hasPactsWith('manyConsumers') { // Will define a consumer for each pact file in the directory. // Consumer name is read from contents of pact file pactFileLocation = file('path/to/pacts') } } } } ``` ### 3. Execute `gradle pactVerify` ## Specifying the provider hostname at runtime If you need to calculate the provider hostname at runtime, you can give a Closure as the provider host. ```groovy pact { serviceProviders { provider1 { host = { lookupHostName() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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). ## Enabling insecure SSL [version 2.2.8+] For providers that are running on SSL with self-signed certificates, you need to enable insecure SSL mode by setting `insecure = true` on the provider. ```groovy pact { serviceProviders { provider1 { insecure = true // allow SSL with a self-signed cert hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## Specifying a custom trust store [version 2.2.8+] For environments that are running their own certificate chains: ```groovy pact { serviceProviders { provider1 { trustStore = new File('relative/path/to/trustStore.jks') trustStorePassword = 'changeit' hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } `trustStore` is either relative to the current working (build) directory. `trustStorePassword` defaults to `changeit`. NOTE: The hostname will still be verified against the certificate. ## Modifying the HTTP Client Used [version 2.2.4+] The default HTTP client is used for all requests to providers (created with a call to `HttpClients.createDefault()`). This can be changed by specifying a closure assigned to createClient on the provider that returns a CloseableHttpClient. For example: ```groovy pact { serviceProviders { provider1 { createClient = { provider -> // This will enable the client to accept self-signed certificates HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()) .setSslcontext(new SSLContextBuilder().loadTrustMaterial(null, { x509Certificates, s -> true }) .build()) .build() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## Modifying the requests before they are sent **NOTE on breaking change: Version 2.1.8+ uses Apache HttpClient instead of HttpBuilder so the closure will receive a HttpRequest object instead of a request Map.** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Pact Gradle plugin provides a request filter that can be set to a closure on the provider that will be called before the request is made. This closure will receive the HttpRequest prior to it being executed. ```groovy pact { serviceProviders { provider1 { requestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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| |pact.filter.consumers|Comma seperated list of consumer names to verify| |pact.filter.description|Only verify interactions whose description match the provided regular expression| |pact.filter.providerState|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state| ## Provider States For a description of what provider states are, see the wiki in the Ruby project: https://github.com/realestate-com-au/pact/wiki/Provider-states ### Using a state change URL 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. As for normal requests, a request filter (`stateChangeRequestFilter`) can also be set to manipulate the request before it is sent. You can also give a Closure for the stateChange that returns the URL. ```groovy 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 stateChangeRequestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } } // or hasPactsWith('consumers') { pactFileLocation = file('path/to/pacts') 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. ### Using a Closure [version 2.2.2+] You can set a closure to be called before each verification with a defined provider state. The closure will be called with the state description from the pact file. If you also require the state change request to be executed, return the URL for the request (as a URL, URI or String) from the closure. Otherwise, return null or false. ```groovy pact { serviceProviders { provider1 { hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') // Load a fixture file based on the provider state and then setup some database // data. Does not require a state change request so returns false stateChange = { providerState -> def fixture = loadFixtuerForProviderState(providerState) setupDatabase(fixture) false } } } } } ``` ## Filtering the interactions that are verified You can filter the interactions that are run using three project properties: `pact.filter.consumers`, `pact.filter.description` and `pact.filter.providerState`. Adding `-Ppact.filter.consumers=consumer1,consumer2` to the command line will only run the pact files for those consumers (consumer1 and consumer2). Adding `-Ppact.filter.description=a request for payment.*` will only run those interactions whose descriptions start with 'a request for payment'. `-Ppact.filter.providerState=.*payment` will match any interaction that has a provider state that ends with payment, and `-Ppact.filter.providerState=` will match any interaction that does not have a provider state. ## Publishing to the Gradle Community Portal To publish the plugin to the community portal: $ ./gradlew :pact-jvm-provider-gradle_2.11:publishPlugins # Publishing pact files to a pact broker *[version 2.2.7+]* The pact gradle plugin provides a `pactPublish` task that can publish all pact files in a directory to a pact broker. To use it, you need to add a publish configuration to the pact configuration that defines the directory where the pact files are and the URL to the pact broker. For example: ```groovy pact { publish { pactDirectory = '/pact/dir' // defaults to $buildDir/pacts pactBrokerUrl = 'http://pactbroker:1234' } } ```

Group: au.com.dius Artifact: pact-jvm-provider-gradle_2.10
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-provider-gradle_2.10
Group au.com.dius
Version 2.2.8
Last update 08. July 2015
Tags: showstacktrace need requestfilter using passed store calculate supports creates plugin matches defaults pactstatechange truststorepassword providers created stacktrace these oauth defined host ends contents httpclients shown loadfixtuerforproviderstate header starttheapp project defines load each specify examples diagnosing lookuphostname serviceproviders unique give specifying before data made states setupdatabase seperated running executed life could loadtrustmaterial current publishplugins noophostnameverifier publish shutdown https define payment trust consumer1 either ppact pactbrokerurl what consumer2 string down configuration publishing expression body client change httpclient mavencentral normal apache jetty consumer must localhost descriptions after would description optional pactpublish execute comma whose environments haspactwith hostname script that statechange changeit names against require case example span does terminate ruby setsslcontext setting following setsslhostnameverifier httpbuilder json name provider1 interactions protocol regular community assigned provides 8080 provider still which authentication provided actual adding statechangerequestfilter github pacts httprequest terminateprovidertask they filtering configured verify accept otherwise insecure modifying help certificate errors file verified empty false only tokens working startprovidertask groovy sslcontextbuilder again interaction pactfile truststore many builddir sensible haspactswith enabling x509certificates verification start http then will closure some small port realestate repositories plugins query line switch self build providerstate version mode typical cert dependencies command starting wiki built "null" note files post signed killtheapp haven return persisted true specified directory pactfilelocation broker based apply sometimes being enable kill gradle_2 authorization used where been changed prior requests sent shutting request when statechangeusesbody closeablehttpclient value three pactbroker returns custom portal consumers class here buildscript property printing properties pactdirectory relative classpath 1234 default pact called gradle createdefault match this addheader filter call fixture allow verifying have behaviour state runtime currently manipulate object from turns network pactverify parameter setup path below read receive between certificates gradlew with those task chains your createclient list tasks eyjhbgcioijsuzi1niisimn0esi6imfw database pproperty versions 8001 instead uses manyconsumers things their also breaking dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 6
Dependencies scala-library, http-builder, slf4j-api, pact-jvm-provider_2.10, json4s-native_2.10, json4s-jackson_2.10,
There are maybe transitive dependencies!

pact-jvm-provider-gradle_2.10 from group au.com.dius (version 2.2.7)

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 ### For Gradle versions prior to 2.1 #### 1.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.2.1' } } ``` #### 1.2. Apply the pact plugin ```groovy apply plugin: 'au.com.dius.pact' ``` ### For Gradle versions 2.1+ ```groovy plugins { id "au.com.dius.pact" version "2.2.1" } ``` ### 2. 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') { // currently supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } // Or if you have many pact files in a directory hasPactsWith('manyConsumers') { // Will define a consumer for each pact file in the directory. // Consumer name is read from contents of pact file pactFileLocation = file('path/to/pacts') } } } } ``` ### 3. Execute `gradle pactVerify` ## Specifying the provider hostname at runtime If you need to calculate the provider hostname at runtime, you can give a Closure as the provider host. ```groovy pact { serviceProviders { provider1 { host = { lookupHostName() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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). ## Modifying the HTTP Client Used [version 2.2.4+] The default HTTP client is used for all requests to providers (created with a call to `HttpClients.createDefault()`). This can be changed by specifying a closure assigned to createClient on the provider that returns a CloseableHttpClient. For example: ```groovy pact { serviceProviders { provider1 { createClient = { provider -> // This will enable the client to accept self-signed certificates HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()) .setSslcontext(new SSLContextBuilder().loadTrustMaterial(null, { x509Certificates, s -> true }) .build()) .build() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## Modifying the requests before they are sent **NOTE on breaking change: Version 2.1.8+ uses Apache HttpClient instead of HttpBuilder so the closure will receive a HttpRequest object instead of a request Map.** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Pact Gradle plugin provides a request filter that can be set to a closure on the provider that will be called before the request is made. This closure will receive the HttpRequest prior to it being executed. ```groovy pact { serviceProviders { provider1 { requestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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| |pact.filter.consumers|Comma seperated list of consumer names to verify| |pact.filter.description|Only verify interactions whose description match the provided regular expression| |pact.filter.providerState|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state| ## Provider States For a description of what provider states are, see the wiki in the Ruby project: https://github.com/realestate-com-au/pact/wiki/Provider-states ### Using a state change URL 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. As for normal requests, a request filter (`stateChangeRequestFilter`) can also be set to manipulate the request before it is sent. You can also give a Closure for the stateChange that returns the URL. ```groovy 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 stateChangeRequestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } } // or hasPactsWith('consumers') { pactFileLocation = file('path/to/pacts') 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. ### Using a Closure [version 2.2.2+] You can set a closure to be called before each verification with a defined provider state. The closure will be called with the state description from the pact file. If you also require the state change request to be executed, return the URL for the request (as a URL, URI or String) from the closure. Otherwise, return null or false. ```groovy pact { serviceProviders { provider1 { hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') // Load a fixture file based on the provider state and then setup some database // data. Does not require a state change request so returns false stateChange = { providerState -> def fixture = loadFixtuerForProviderState(providerState) setupDatabase(fixture) false } } } } } ``` ## Filtering the interactions that are verified You can filter the interactions that are run using three project properties: `pact.filter.consumers`, `pact.filter.description` and `pact.filter.providerState`. Adding `-Ppact.filter.consumers=consumer1,consumer2` to the command line will only run the pact files for those consumers (consumer1 and consumer2). Adding `-Ppact.filter.description=a request for payment.*` will only run those interactions whose descriptions start with 'a request for payment'. `-Ppact.filter.providerState=.*payment` will match any interaction that has a provider state that ends with payment, and `-Ppact.filter.providerState=` will match any interaction that does not have a provider state. ## Publishing to the Gradle Community Portal To publish the plugin to the community portal: $ ./gradlew :pact-jvm-provider-gradle_2.11:publishPlugins # Publishing pact files to a pact broker *[version 2.2.7+]* The pact gradle plugin provides a `pactPublish` task that can publish all pact files in a directory to a pact broker. To use it, you need to add a publish configuration to the pact configuration that defines the directory where the pact files are and the URL to the pact broker. For example: ```groovy pact { publish { pactDirectory = '/pact/dir' // defaults to $buildDir/pacts pactBrokerUrl = 'http://pactbroker:1234' } } ```

Group: au.com.dius Artifact: pact-jvm-provider-gradle_2.10
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-provider-gradle_2.10
Group au.com.dius
Version 2.2.7
Last update 07. July 2015
Tags: need showstacktrace using requestfilter passed calculate supports creates plugin matches defaults pactstatechange providers created stacktrace these oauth defined host ends contents httpclients shown loadfixtuerforproviderstate starttheapp header project defines load each specify examples diagnosing lookuphostname serviceproviders unique give specifying before data made states setupdatabase seperated executed life could loadtrustmaterial publishplugins noophostnameverifier publish shutdown https define payment consumer1 ppact pactbrokerurl what consumer2 string down configuration publishing expression body client change httpclient mavencentral normal apache jetty consumer must localhost descriptions after would description optional pactpublish execute comma whose haspactwith hostname script that statechange names against require example case span does terminate ruby setsslcontext following setsslhostnameverifier httpbuilder json name provider1 interactions protocol regular community assigned provides 8080 provider which authentication provided actual adding statechangerequestfilter github pacts httprequest terminateprovidertask they filtering configured verify accept otherwise modifying help errors verified file empty false only tokens startprovidertask groovy sslcontextbuilder again interaction pactfile many builddir sensible haspactswith x509certificates verification start http then will closure some small port realestate repositories plugins query line switch self build providerstate version typical dependencies command starting wiki built "null" note files post signed killtheapp return haven true persisted specified directory pactfilelocation broker based apply sometimes being enable kill authorization gradle_2 used where been changed prior requests sent shutting request when statechangeusesbody value closeablehttpclient three pactbroker returns custom portal consumers class here printing property buildscript properties pactdirectory classpath 1234 default pact called gradle createdefault match addheader this filter call fixture verifying have behaviour state runtime currently manipulate object from turns network pactverify parameter setup path below read receive between certificates gradlew with those task your createclient list tasks eyjhbgcioijsuzi1niisimn0esi6imfw database pproperty versions 8001 instead uses manyconsumers things also breaking dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 6
Dependencies scala-library, http-builder, slf4j-api, pact-jvm-provider_2.10, json4s-native_2.10, json4s-jackson_2.10,
There are maybe transitive dependencies!

pact-jvm-provider-gradle_2.10 from group au.com.dius (version 2.2.6)

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 ### For Gradle versions prior to 2.1 #### 1.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.2.1' } } ``` #### 1.2. Apply the pact plugin ```groovy apply plugin: 'au.com.dius.pact' ``` ### For Gradle versions 2.1+ ```groovy plugins { id "au.com.dius.pact" version "2.2.1" } ``` ### 2. 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') { // currently supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } // Or if you have many pact files in a directory hasPactsWith('manyConsumers') { // Will define a consumer for each pact file in the directory. // Consumer name is read from contents of pact file pactFileLocation = file('path/to/pacts') } } } } ``` ### 3. Execute `gradle pactVerify` ## Specifying the provider hostname at runtime If you need to calculate the provider hostname at runtime, you can give a Closure as the provider host. ```groovy pact { serviceProviders { provider1 { host = { lookupHostName() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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). ## Modifying the HTTP Client Used [version 2.2.4+] The default HTTP client is used for all requests to providers (created with a call to `HttpClients.createDefault()`). This can be changed by specifying a closure assigned to createClient on the provider that returns a CloseableHttpClient. For example: ```groovy pact { serviceProviders { provider1 { createClient = { provider -> // This will enable the client to accept self-signed certificates HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()).build() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## Modifying the requests before they are sent **NOTE on breaking change: Version 2.1.8+ uses Apache HttpClient instead of HttpBuilder so the closure will receive a HttpRequest object instead of a request Map.** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Pact Gradle plugin provides a request filter that can be set to a closure on the provider that will be called before the request is made. This closure will receive the HttpRequest prior to it being executed. ```groovy pact { serviceProviders { provider1 { requestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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| |pact.filter.consumers|Comma seperated list of consumer names to verify| |pact.filter.description|Only verify interactions whose description match the provided regular expression| |pact.filter.providerState|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state| ## Provider States For a description of what provider states are, see the wiki in the Ruby project: https://github.com/realestate-com-au/pact/wiki/Provider-states ### Using a state change URL 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. As for normal requests, a request filter (`stateChangeRequestFilter`) can also be set to manipulate the request before it is sent. You can also give a Closure for the stateChange that returns the URL. ```groovy 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 stateChangeRequestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } } // or hasPactsWith('consumers') { pactFileLocation = file('path/to/pacts') 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. ### Using a Closure [version 2.2.2+] You can set a closure to be called before each verification with a defined provider state. The closure will be called with the state description from the pact file. If you also require the state change request to be executed, return the URL for the request (as a URL, URI or String) from the closure. Otherwise, return null or false. ```groovy pact { serviceProviders { provider1 { hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') // Load a fixture file based on the provider state and then setup some database // data. Does not require a state change request so returns false stateChange = { providerState -> def fixture = loadFixtuerForProviderState(providerState) setupDatabase(fixture) false } } } } } ``` ## Filtering the interactions that are verified You can filter the interactions that are run using three project properties: `pact.filter.consumers`, `pact.filter.description` and `pact.filter.providerState`. Adding `-Ppact.filter.consumers=consumer1,consumer2` to the command line will only run the pact files for those consumers (consumer1 and consumer2). Adding `-Ppact.filter.description=a request for payment.*` will only run those interactions whose descriptions start with 'a request for payment'. `-Ppact.filter.providerState=.*payment` will match any interaction that has a provider state that ends with payment, and `-Ppact.filter.providerState=` will match any interaction that does not have a provider state. ## Publishing to the Gradle Community Portal To publish the plugin to the community portal: $ gradle :pact-jvm-provider-gradle_2.11:publishPlugins

Group: au.com.dius Artifact: pact-jvm-provider-gradle_2.10
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-provider-gradle_2.10
Group au.com.dius
Version 2.2.6
Last update 02. July 2015
Tags: need showstacktrace using requestfilter passed calculate supports creates plugin matches defaults pactstatechange providers created stacktrace these oauth defined host ends contents httpclients shown loadfixtuerforproviderstate starttheapp header project load each specify examples diagnosing lookuphostname serviceproviders unique give specifying before data made states setupdatabase seperated executed life could publishplugins noophostnameverifier publish shutdown https define payment consumer1 ppact what consumer2 string down publishing expression body client change httpclient mavencentral normal apache jetty consumer must localhost descriptions after would description optional comma execute whose haspactwith hostname script that statechange names against require example case span does terminate ruby httpbuilder setsslhostnameverifier following json name provider1 interactions protocol regular community assigned provides 8080 provider which authentication provided actual adding statechangerequestfilter github pacts httprequest terminateprovidertask they filtering configured verify accept otherwise modifying help errors verified file empty false only tokens startprovidertask groovy again interaction pactfile many sensible haspactswith verification start http then will closure some small port realestate repositories plugins query line switch self build providerstate version typical dependencies command starting wiki built "null" note files post signed killtheapp return haven true persisted specified directory pactfilelocation based apply sometimes being enable kill gradle_2 authorization used been prior changed requests sent shutting request when statechangeusesbody value closeablehttpclient three returns custom portal consumers class here printing property buildscript properties classpath default pact called gradle createdefault match addheader this filter call fixture verifying have behaviour state runtime currently manipulate object from turns network pactverify parameter setup path below read receive between certificates with those task your createclient list tasks eyjhbgcioijsuzi1niisimn0esi6imfw database pproperty versions 8001 instead uses manyconsumers things also breaking dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 5
Dependencies scala-library, pact-jvm-provider_2.10, slf4j-api, json4s-native_2.10, json4s-jackson_2.10,
There are maybe transitive dependencies!

pact-jvm-provider-gradle_2.10 from group au.com.dius (version 2.2.5)

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 ### For Gradle versions prior to 2.1 #### 1.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.2.1' } } ``` #### 1.2. Apply the pact plugin ```groovy apply plugin: 'au.com.dius.pact' ``` ### For Gradle versions 2.1+ ```groovy plugins { id "au.com.dius.pact" version "2.2.1" } ``` ### 2. 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') { // currently supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } // Or if you have many pact files in a directory hasPactsWith('manyConsumers') { // Will define a consumer for each pact file in the directory. // Consumer name is read from contents of pact file pactFileLocation = file('path/to/pacts') } } } } ``` ### 3. Execute `gradle pactVerify` ## Specifying the provider hostname at runtime If you need to calculate the provider hostname at runtime, you can give a Closure as the provider host. ```groovy pact { serviceProviders { provider1 { host = { lookupHostName() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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). ## Modifying the HTTP Client Used [version 2.2.4+] The default HTTP client is used for all requests to providers (created with a call to `HttpClients.createDefault()`). This can be changed by specifying a closure assigned to createClient on the provider that returns a CloseableHttpClient. For example: ```groovy pact { serviceProviders { provider1 { createClient = { provider -> // This will enable the client to accept self-signed certificates HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()).build() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## Modifying the requests before they are sent **NOTE on breaking change: Version 2.1.8+ uses Apache HttpClient instead of HttpBuilder so the closure will receive a HttpRequest object instead of a request Map.** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Pact Gradle plugin provides a request filter that can be set to a closure on the provider that will be called before the request is made. This closure will receive the HttpRequest prior to it being executed. ```groovy pact { serviceProviders { provider1 { requestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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| |pact.filter.consumers|Comma seperated list of consumer names to verify| |pact.filter.description|Only verify interactions whose description match the provided regular expression| |pact.filter.providerState|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state| ## Provider States For a description of what provider states are, see the wiki in the Ruby project: https://github.com/realestate-com-au/pact/wiki/Provider-states ### Using a state change URL 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. As for normal requests, a request filter (`stateChangeRequestFilter`) can also be set to manipulate the request before it is sent. You can also give a Closure for the stateChange that returns the URL. ```groovy 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 stateChangeRequestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } } // or hasPactsWith('consumers') { pactFileLocation = file('path/to/pacts') 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. ### Using a Closure [version 2.2.2+] You can set a closure to be called before each verification with a defined provider state. The closure will be called with the state description from the pact file. If you also require the state change request to be executed, return the URL for the request (as a URL, URI or String) from the closure. Otherwise, return null or false. ```groovy pact { serviceProviders { provider1 { hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') // Load a fixture file based on the provider state and then setup some database // data. Does not require a state change request so returns false stateChange = { providerState -> def fixture = loadFixtuerForProviderState(providerState) setupDatabase(fixture) false } } } } } ``` ## Filtering the interactions that are verified You can filter the interactions that are run using three project properties: `pact.filter.consumers`, `pact.filter.description` and `pact.filter.providerState`. Adding `-Ppact.filter.consumers=consumer1,consumer2` to the command line will only run the pact files for those consumers (consumer1 and consumer2). Adding `-Ppact.filter.description=a request for payment.*` will only run those interactions whose descriptions start with 'a request for payment'. `-Ppact.filter.providerState=.*payment` will match any interaction that has a provider state that ends with payment, and `-Ppact.filter.providerState=` will match any interaction that does not have a provider state. ## Publishing to the Gradle Community Portal To publish the plugin to the community portal: $ gradle :pact-jvm-provider-gradle_2.11:publishPlugins

Group: au.com.dius Artifact: pact-jvm-provider-gradle_2.10
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-provider-gradle_2.10
Group au.com.dius
Version 2.2.5
Last update 23. June 2015
Tags: need showstacktrace using requestfilter passed calculate supports creates plugin matches defaults pactstatechange providers created stacktrace these oauth defined host ends contents httpclients shown loadfixtuerforproviderstate starttheapp header project load each specify examples diagnosing lookuphostname serviceproviders unique give specifying before data made states setupdatabase seperated executed life could publishplugins noophostnameverifier publish shutdown https define payment consumer1 ppact what consumer2 string down publishing expression body client change httpclient mavencentral normal apache jetty consumer must localhost descriptions after would description optional comma execute whose haspactwith hostname script that statechange names against require example case span does terminate ruby httpbuilder setsslhostnameverifier following json name provider1 interactions protocol regular community assigned provides 8080 provider which authentication provided actual adding statechangerequestfilter github pacts httprequest terminateprovidertask they filtering configured verify accept otherwise modifying help errors verified file empty false only tokens startprovidertask groovy again interaction pactfile many sensible haspactswith verification start http then will closure some small port realestate repositories plugins query line switch self build providerstate version typical dependencies command starting wiki built "null" note files post signed killtheapp return haven true persisted specified directory pactfilelocation based apply sometimes being enable kill gradle_2 authorization used been prior changed requests sent shutting request when statechangeusesbody value closeablehttpclient three returns custom portal consumers class here printing property buildscript properties classpath default pact called gradle createdefault match addheader this filter call fixture verifying have behaviour state runtime currently manipulate object from turns network pactverify parameter setup path below read receive between certificates with those task your createclient list tasks eyjhbgcioijsuzi1niisimn0esi6imfw database pproperty versions 8001 instead uses manyconsumers things also breaking dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 6
Dependencies scala-library, pact-jvm-provider_2.10, scala-logging-slf4j_2.10, json4s-native_2.10, json4s-jackson_2.10, slf4j-api,
There are maybe transitive dependencies!

pact-jvm-provider-gradle_2.10 from group au.com.dius (version 2.2.4)

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 ### For Gradle versions prior to 2.1 #### 1.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.2.1' } } ``` #### 1.2. Apply the pact plugin ```groovy apply plugin: 'au.com.dius.pact' ``` ### For Gradle versions 2.1+ ```groovy plugins { id "au.com.dius.pact" version "2.2.1" } ``` ### 2. 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') { // currently supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } // Or if you have many pact files in a directory hasPactsWith('manyConsumers') { // Will define a consumer for each pact file in the directory. // Consumer name is read from contents of pact file pactFileLocation = file('path/to/pacts') } } } } ``` ### 3. Execute `gradle pactVerify` ## Specifying the provider hostname at runtime If you need to calculate the provider hostname at runtime, you can give a Closure as the provider host. ```groovy pact { serviceProviders { provider1 { host = { lookupHostName() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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). ## Modifying the HTTP Client Used [version 2.2.4+] The default HTTP client is used for all requests to providers (created with a call to `HttpClients.createDefault()`). This can be changed by specifying a closure assigned to createClient on the provider that returns a CloseableHttpClient. For example: ```groovy pact { serviceProviders { provider1 { createClient = { provider -> // This will enable the client to accept self-signed certificates HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()).build() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## Modifying the requests before they are sent **NOTE on breaking change: Version 2.1.8+ uses Apache HttpClient instead of HttpBuilder so the closure will receive a HttpRequest object instead of a request Map.** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Pact Gradle plugin provides a request filter that can be set to a closure on the provider that will be called before the request is made. This closure will receive the HttpRequest prior to it being executed. ```groovy pact { serviceProviders { provider1 { requestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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| |pact.filter.consumers|Comma seperated list of consumer names to verify| |pact.filter.description|Only verify interactions whose description match the provided regular expression| |pact.filter.providerState|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state| ## Provider States For a description of what provider states are, see the wiki in the Ruby project: https://github.com/realestate-com-au/pact/wiki/Provider-states ### Using a state change URL 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. As for normal requests, a request filter (`stateChangeRequestFilter`) can also be set to manipulate the request before it is sent. You can also give a Closure for the stateChange that returns the URL. ```groovy 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 stateChangeRequestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } } // or hasPactsWith('consumers') { pactFileLocation = file('path/to/pacts') 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. ### Using a Closure [version 2.2.2+] You can set a closure to be called before each verification with a defined provider state. The closure will be called with the state description from the pact file. If you also require the state change request to be executed, return the URL for the request (as a URL, URI or String) from the closure. Otherwise, return null or false. ```groovy pact { serviceProviders { provider1 { hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') // Load a fixture file based on the provider state and then setup some database // data. Does not require a state change request so returns false stateChange = { providerState -> def fixture = loadFixtuerForProviderState(providerState) setupDatabase(fixture) false } } } } } ``` ## Filtering the interactions that are verified You can filter the interactions that are run using three project properties: `pact.filter.consumers`, `pact.filter.description` and `pact.filter.providerState`. Adding `-Ppact.filter.consumers=consumer1,consumer2` to the command line will only run the pact files for those consumers (consumer1 and consumer2). Adding `-Ppact.filter.description=a request for payment.*` will only run those interactions whose descriptions start with 'a request for payment'. `-Ppact.filter.providerState=.*payment` will match any interaction that has a provider state that ends with payment, and `-Ppact.filter.providerState=` will match any interaction that does not have a provider state. ## Publishing to the Gradle Community Portal To publish the plugin to the community portal: $ gradle :pact-jvm-provider-gradle_2.11:publishPlugins

Group: au.com.dius Artifact: pact-jvm-provider-gradle_2.10
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-provider-gradle_2.10
Group au.com.dius
Version 2.2.4
Last update 17. June 2015
Tags: need showstacktrace using requestfilter passed calculate supports creates plugin matches defaults pactstatechange providers created stacktrace these oauth defined host ends contents httpclients shown loadfixtuerforproviderstate starttheapp header project load each specify examples diagnosing lookuphostname serviceproviders unique give specifying before data made states setupdatabase seperated executed life could publishplugins noophostnameverifier publish shutdown https define payment consumer1 ppact what consumer2 string down publishing expression body client change httpclient mavencentral normal apache jetty consumer must localhost descriptions after would description optional comma execute whose haspactwith hostname script that statechange names against require example case span does terminate ruby httpbuilder setsslhostnameverifier following json name provider1 interactions protocol regular community assigned provides 8080 provider which authentication provided actual adding statechangerequestfilter github pacts httprequest terminateprovidertask they filtering configured verify accept otherwise modifying help errors verified file empty false only tokens startprovidertask groovy again interaction pactfile many sensible haspactswith verification start http then will closure some small port realestate repositories plugins query line switch self build providerstate version typical dependencies command starting wiki built "null" note files post signed killtheapp return haven true persisted specified directory pactfilelocation based apply sometimes being enable kill gradle_2 authorization used been prior changed requests sent shutting request when statechangeusesbody value closeablehttpclient three returns custom portal consumers class here printing property buildscript properties classpath default pact called gradle createdefault match addheader this filter call fixture verifying have behaviour state runtime currently manipulate object from turns network pactverify parameter setup path below read receive between certificates with those task your createclient list tasks eyjhbgcioijsuzi1niisimn0esi6imfw database pproperty versions 8001 instead uses manyconsumers things also breaking dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 6
Dependencies pact-jvm-provider_2.10, scala-library, scala-logging-slf4j_2.10, json4s-native_2.10, json4s-jackson_2.10, slf4j-api,
There are maybe transitive dependencies!

pact-jvm-provider-gradle_2.10 from group au.com.dius (version 2.2.3)

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 ### For Gradle versions prior to 2.1 #### 1.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.2.1' } } ``` #### 1.2. Apply the pact plugin ```groovy apply plugin: 'au.com.dius.pact' ``` ### For Gradle versions 2.1+ ```groovy plugins { id "au.com.dius.pact" version "2.2.1" } ``` ### 2. 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') { // currently supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } // Or if you have many pact files in a directory hasPactsWith('manyConsumers') { // Will define a consumer for each pact file in the directory. // Consumer name is read from contents of pact file pactFileLocation = file('path/to/pacts') } } } } ``` ### 3. Execute `gradle pactVerify` ## Specifying the provider hostname at runtime If you need to calculate the provider hostname at runtime, you can give a Closure as the provider host. ```groovy pact { serviceProviders { provider1 { host = { lookupHostName() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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). ## Modifying the requests before they are sent **NOTE on breaking change: Version 2.1.8+ uses Apache HttpClient instead of HttpBuilder so the closure will receive a HttpRequest object instead of a request Map.** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Pact Gradle plugin provides a request filter that can be set to a closure on the provider that will be called before the request is made. This closure will receive the HttpRequest prior to it being executed. ```groovy pact { serviceProviders { provider1 { requestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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| |pact.filter.consumers|Comma seperated list of consumer names to verify| |pact.filter.description|Only verify interactions whose description match the provided regular expression| |pact.filter.providerState|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state| ## Provider States For a description of what provider states are, see the wiki in the Ruby project: https://github.com/realestate-com-au/pact/wiki/Provider-states ### Using a state change URL 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. As for normal requests, a request filter (`stateChangeRequestFilter`) can also be set to manipulate the request before it is sent. You can also give a Closure for the stateChange that returns the URL. ```groovy 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 stateChangeRequestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } } // or hasPactsWith('consumers') { pactFileLocation = file('path/to/pacts') 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. ### Using a Closure [version 2.2.2+] You can set a closure to be called before each verification with a defined provider state. The closure will be called with the state description from the pact file. If you also require the state change request to be executed, return the URL for the request (as a URL, URI or String) from the closure. Otherwise, return null or false. ```groovy pact { serviceProviders { provider1 { hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') // Load a fixture file based on the provider state and then setup some database // data. Does not require a state change request so returns false stateChange = { providerState -> def fixture = loadFixtuerForProviderState(providerState) setupDatabase(fixture) false } } } } } ``` ## Filtering the interactions that are verified You can filter the interactions that are run using three project properties: `pact.filter.consumers`, `pact.filter.description` and `pact.filter.providerState`. Adding `-Ppact.filter.consumers=consumer1,consumer2` to the command line will only run the pact files for those consumers (consumer1 and consumer2). Adding `-Ppact.filter.description=a request for payment.*` will only run those interactions whose descriptions start with 'a request for payment'. `-Ppact.filter.providerState=.*payment` will match any interaction that has a provider state that ends with payment, and `-Ppact.filter.providerState=` will match any interaction that does not have a provider state. ## Publishing to the Gradle Community Portal To publish the plugin to the community portal: $ gradle :pact-jvm-provider-gradle_2.11:publishPlugins

Group: au.com.dius Artifact: pact-jvm-provider-gradle_2.10
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-provider-gradle_2.10
Group au.com.dius
Version 2.2.3
Last update 14. June 2015
Tags: need showstacktrace using requestfilter passed calculate supports creates plugin defaults matches pactstatechange providers stacktrace these oauth defined host ends contents shown loadfixtuerforproviderstate header starttheapp project load each examples specify diagnosing lookuphostname serviceproviders unique give specifying before data made states setupdatabase seperated executed life could publishplugins publish shutdown https define payment consumer1 ppact what consumer2 string down publishing expression body change httpclient mavencentral normal apache jetty consumer must localhost descriptions after would description optional comma execute whose haspactwith hostname script that statechange names against require case span does terminate ruby httpbuilder following json name provider1 interactions protocol regular community provides 8080 provider which authentication actual provided adding statechangerequestfilter pacts github httprequest terminateprovidertask they filtering configured verify otherwise modifying help errors verified file empty false tokens only startprovidertask groovy again interaction pactfile many sensible haspactswith verification start http then will closure some small port realestate repositories plugins query line switch build providerstate version typical dependencies command starting wiki built "null" note files post killtheapp return haven true persisted specified directory pactfilelocation based apply sometimes being kill gradle_2 authorization been prior requests sent shutting statechangeusesbody when request three value returns portal consumers here class printing buildscript property properties classpath pact called gradle match addheader this filter fixture verifying have behaviour state runtime currently manipulate object from turns network pactverify parameter setup path below read receive between with those task your list tasks eyjhbgcioijsuzi1niisimn0esi6imfw database pproperty versions 8001 instead uses manyconsumers things also breaking dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 6
Dependencies scala-library, scala-logging-slf4j_2.10, pact-jvm-provider_2.10, json4s-native_2.10, json4s-jackson_2.10, slf4j-api,
There are maybe transitive dependencies!

pact-jvm-provider-gradle_2.10 from group au.com.dius (version 2.2.2)

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 ### For Gradle versions prior to 2.1 #### 1.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.2.1' } } ``` #### 1.2. Apply the pact plugin ```groovy apply plugin: 'au.com.dius.pact' ``` ### For Gradle versions 2.1+ ```groovy plugins { id "au.com.dius.pact" version "2.2.1" } ``` ### 2. 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') { // currently supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } // Or if you have many pact files in a directory hasPactsWith('manyConsumers') { // Will define a consumer for each pact file in the directory. // Consumer name is read from contents of pact file pactFileLocation = file('path/to/pacts') } } } } ``` ### 3. Execute `gradle pactVerify` ## Specifying the provider hostname at runtime If you need to calculate the provider hostname at runtime, you can give a Closure as the provider host. ```groovy pact { serviceProviders { provider1 { host = { lookupHostName() } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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). ## Modifying the requests before they are sent **NOTE on breaking change: Version 2.1.8+ uses Apache HttpClient instead of HttpBuilder so the closure will receive a HttpRequest object instead of a request Map.** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Pact Gradle plugin provides a request filter that can be set to a closure on the provider that will be called before the request is made. This closure will receive the HttpRequest prior to it being executed. ```groovy pact { serviceProviders { provider1 { requestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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| |pact.filter.consumers|Comma seperated list of consumer names to verify| |pact.filter.description|Only verify interactions whose description match the provided regular expression| |pact.filter.providerState|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state| ## Provider States For a description of what provider states are, see the wiki in the Ruby project: https://github.com/realestate-com-au/pact/wiki/Provider-states ### Using a state change URL 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. As for normal requests, a request filter (`stateChangeRequestFilter`) can also be set to manipulate the request before it is sent. You can also give a Closure for the stateChange that returns the URL. ```groovy 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 stateChangeRequestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } } // or hasPactsWith('consumers') { pactFileLocation = file('path/to/pacts') 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. ### Using a Closure [version 2.2.2+] You can set a closure to be called before each verification with a defined provider state. The closure will be called with the state description from the pact file. If you also require the state change request to be executed, return the URL for the request (as a URL, URI or String) from the closure. Otherwise, return null or false. ```groovy pact { serviceProviders { provider1 { hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') // Load a fixture file based on the provider state and then setup some database // data. Does not require a state change request so returns false stateChange = { providerState -> def fixture = loadFixtuerForProviderState(providerState) setupDatabase(fixture) false } } } } } ``` ## Filtering the interactions that are verified You can filter the interactions that are run using three project properties: `pact.filter.consumers`, `pact.filter.description` and `pact.filter.providerState`. Adding `-Ppact.filter.consumers=consumer1,consumer2` to the command line will only run the pact files for those consumers (consumer1 and consumer2). Adding `-Ppact.filter.description=a request for payment.*` will only run those interactions whose descriptions start with 'a request for payment'. `-Ppact.filter.providerState=.*payment` will match any interaction that has a provider state that ends with payment, and `-Ppact.filter.providerState=` will match any interaction that does not have a provider state. ## Publishing to the Gradle Community Portal To publish the plugin to the community portal: $ gradle :pact-jvm-provider-gradle_2.11:publishPlugins

Group: au.com.dius Artifact: pact-jvm-provider-gradle_2.10
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-provider-gradle_2.10
Group au.com.dius
Version 2.2.2
Last update 10. June 2015
Tags: need showstacktrace using requestfilter passed calculate supports creates plugin defaults matches pactstatechange providers stacktrace these oauth defined host ends contents shown loadfixtuerforproviderstate header starttheapp project load each examples specify diagnosing lookuphostname serviceproviders unique give specifying before data made states setupdatabase seperated executed life could publishplugins publish shutdown https define payment consumer1 ppact what consumer2 string down publishing expression body change httpclient mavencentral normal apache jetty consumer must localhost descriptions after would description optional comma execute whose haspactwith hostname script that statechange names against require case span does terminate ruby httpbuilder following json name provider1 interactions protocol regular community provides 8080 provider which authentication actual provided adding statechangerequestfilter pacts github httprequest terminateprovidertask they filtering configured verify otherwise modifying help errors verified file empty false tokens only startprovidertask groovy again interaction pactfile many sensible haspactswith verification start http then will closure some small port realestate repositories plugins query line switch build providerstate version typical dependencies command starting wiki built "null" note files post killtheapp return haven true persisted specified directory pactfilelocation based apply sometimes being kill gradle_2 authorization been prior requests sent shutting statechangeusesbody when request three value returns portal consumers here class printing buildscript property properties classpath pact called gradle match addheader this filter fixture verifying have behaviour state runtime currently manipulate object from turns network pactverify parameter setup path below read receive between with those task your list tasks eyjhbgcioijsuzi1niisimn0esi6imfw database pproperty versions 8001 instead uses manyconsumers things also breaking dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 6
Dependencies pact-jvm-provider_2.10, scala-library, scala-logging-slf4j_2.10, slf4j-api, json4s-native_2.10, json4s-jackson_2.10,
There are maybe transitive dependencies!

pact-jvm-provider-gradle_2.10 from group au.com.dius (version 2.2.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 ### For Gradle versions prior to 2.1 #### 1.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.10' } } ``` #### 1.2. Apply the pact plugin ```groovy apply plugin: 'au.com.dius.pact' ``` ### For Gradle versions 2.1+ ```groovy plugins { id "au.com.dius.pact" version "2.1.1" } ``` ### 2. 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') { // currently supports a file path using file() or a URL using url() pactFile = file('path/to/provider1-consumer1-pact.json') } // Or if you have many pact files in a directory hasPactsWith('manyConsumers') { // Will define a consumer for each pact file in the directory. // Consumer name is read from contents of pact file pactFileLocation = file('path/to/pacts') } } } } ``` ### 3. 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). ## Modifying the requests before they are sent **NOTE on breaking change: Version 2.1.8+ uses Apache HttpClient instead of HttpBuilder so the closure will receive a HttpRequest object instead of a request Map.** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Pact Gradle plugin provides a request filter that can be set to a closure on the provider that will be called before the request is made. This closure will receive the HttpRequest prior to it being executed. ```groovy pact { serviceProviders { provider1 { requestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } hasPactWith('consumer1') { pactFile = file('path/to/provider1-consumer1-pact.json') } } } } ``` ## 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| |pact.filter.consumers|Comma seperated list of consumer names to verify| |pact.filter.description|Only verify interactions whose description match the provided regular expression| |pact.filter.providerState|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state| ## 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. As for normal requests, a request filter (`stateChangeRequestFilter`) can also be set to manipulate the request before it is sent. ``` 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 stateChangeRequestFilter = { req -> // Add an authorization header to each request req.addHeader('Authorization', 'OAUTH eyJhbGciOiJSUzI1NiIsImN0eSI6ImFw...') } } // or hasPactsWith('consumers') { pactFileLocation = file('path/to/pacts') 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. ## Filtering the interactions that are verified You can filter the interactions that are run using three project properties: `pact.filter.consumers`, `pact.filter.description` and `pact.filter.providerState`. Adding `-Ppact.filter.consumers=consumer1,consumer2` to the command line will only run the pact files for those consumers (consumer1 and consumer2). Adding `-Ppact.filter.description=a request for payment.*` will only run those interactions whose descriptions start with 'a request for payment'. `-Ppact.filter.providerState=.*payment` will match any interaction that has a provider state that ends with payment, and `-Ppact.filter.providerState=` will match any interaction that does not have a provider state. ## Publishing to the Gradle Community Portal To publish the plugin to the community portal: $ gradle :pact-jvm-provider-gradle_2.11:publishPlugins

Group: au.com.dius Artifact: pact-jvm-provider-gradle_2.10
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-provider-gradle_2.10
Group au.com.dius
Version 2.2.1
Last update 21. May 2015
Tags: need showstacktrace using requestfilter passed supports creates plugin defaults matches pactstatechange providers stacktrace these oauth defined host ends contents shown header starttheapp project each examples specify diagnosing serviceproviders unique before made states seperated executed life could publishplugins publish shutdown define payment consumer1 ppact consumer2 string down publishing expression body change normal httpclient mavencentral apache jetty consumer must localhost descriptions after would description optional comma execute whose haspactwith script that statechange names against case span does terminate httpbuilder following json name provider1 interactions protocol regular community provides provider 8080 which authentication provided actual statechangerequestfilter pacts adding httprequest terminateprovidertask they filtering configured verify modifying help errors verified file empty tokens only false startprovidertask groovy again interaction pactfile many sensible haspactswith start http then will closure small port repositories plugins query line switch build providerstate version typical dependencies command starting built note files post killtheapp haven persisted true specified directory pactfilelocation apply sometimes being kill gradle_2 authorization been prior requests sent shutting when request statechangeusesbody three value portal consumers here class buildscript property printing properties classpath pact called gradle match this addheader filter verifying have behaviour state currently manipulate from object turns network pactverify parameter path below read receive between with those task your list tasks eyjhbgcioijsuzi1niisimn0esi6imfw pproperty 8001 versions instead uses manyconsumers things also breaking dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 8
Dependencies dispatch-core_2.10, scala-library, unfiltered-netty-server_2.10, pact-jvm-provider_2.10, scala-logging-slf4j_2.10, slf4j-api, json4s-native_2.10, json4s-jackson_2.10,
There are maybe transitive dependencies!



Page 4 from 7 (items total 64)


© 2015 - 2024 Weber Informatics LLC | Privacy Policy