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

Download all versions of pact-jvm-consumer-groovy_2.11 JAR files with all dependencies

Search JAR files by class name

pact-jvm-consumer-groovy_2.11 from group au.com.dius (version 2.1.3)

Group: au.com.dius Artifact: pact-jvm-consumer-groovy_2.11
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-consumer-groovy_2.11
Group au.com.dius
Version 2.1.3


pact-jvm-consumer-groovy_2.11 from group au.com.dius (version 2.1.2)

pact-jvm-consumer-groovy ========================= Groovy DSL for Pact JVM ##Dependency The library is available on maven central using: * group-id = `au.com.dius` * artifact-id = `pact-jvm-consumer-groovy_2.11` * version-id = `2.1.0` ##Usage Add the `pact-jvm-consumer-groovy` library to your test class path. This provides a `PactBuilder` class for you to use to define your pacts. For a full example, have a look at the example JUnit `ExampleGroovyConsumerPactTest`. If you are using gradle for your build, add it to your `build.gradle`: dependencies { testCompile 'au.com.dius:pact-jvm-consumer-groovy_2.11:2.1.0' } Then create an instance of the `PactBuilder` in your test. ```groovy @Test void "A service consumer side of a pact goes a little something like this"() { def alice_service = new PactBuilder() // Create a new PactBuilder alice_service { serviceConsumer "Consumer" // Define the service consumer by name hasPactWith "Alice Service" // Define the service provider that it has a pact with port 1234 // The port number for the service. It is optional, leave it out to // to use a random one given('there is some good mallory') // defines a provider state. It is optional. uponReceiving('a retrieve Mallory request') // upon_receiving starts a new interaction withAttributes(method: 'get', path: '/mallory') // define the request, a GET request to '/mallory' willRespondWith( // define the response we want returned status: 200, headers: ['Content-Type': 'text/html'], body: '"That is some good Mallory."' ) } // Execute the run method to have the mock server run. // It takes a closure to execute your requests and returns a Pact VerificationResult. VerificationResult result = alice_service.run() { def client = new RESTClient('http://localhost:1234/') def alice_response = client.get(path: '/mallory') assert alice_response.status == 200 assert alice_response.contentType == 'text/html' def data = alice_response.data.text() assert data == '"That is some good Mallory."' } assert result == PactVerified$.MODULE$ // This means it is all good in weird Scala speak. } ``` After running this test, the following pact file is produced: { "provider" : { "name" : "Alice Service" }, "consumer" : { "name" : "Consumer" }, "interactions" : [ { "provider_state" : "there is some good mallory", "description" : "a retrieve Mallory request", "request" : { "method" : "get", "path" : "/mallory", "requestMatchers" : { } }, "response" : { "status" : 200, "headers" : { "Content-Type" : "text/html" }, "body" : "That is some good Mallory.", "responseMatchers" : { } } } ] } ### DSL Methods #### serviceConsumer(String consumer) This names the service consumer for the pact. #### hasPactWith(String provider) This names the service provider for the pact. #### port(int port) Sets the port that the mock server will run on. If not supplied, a random port will be used. #### given(String providerState) Defines a state that the provider needs to be in for the request to succeed. For more info, see https://github.com/realestate-com-au/pact/wiki/Provider-states #### uponReceiving(String requestDescription) Starts the definition of a of a pact interaction. #### withAttributes(Map requestData) Defines the request for the interaction. The request data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | method | The HTTP method to use | get | | path | The Path for the request | / | | query | Query parameters as a Map<String, List> | | | headers | Map of key-value pairs for the request headers | | | body | The body of the request. If it is not a string, it will be converted to JSON. Also accepts a PactBodyBuilder. | | #### withBody(Closure closure) Constructs the body of the request or response by invoking the supplied closure in the context of a PactBodyBuilder. #### willRespondWith(Map responseData) Defines the response for the interaction. The response data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | status | The HTTP status code to return | 200 | | headers | Map of key-value pairs for the response headers | | | body | The body of the response. If it is not a string, it will be converted to JSON. Also accepts a PactBodyBuilder. | | #### VerificationResult run(Closure closure) The `run` method starts the mock server, and then executes the provided closure. It then returns the pact verification result for the pact run. If you require access to the mock server configuration for the URL, it is passed into the closure, e.g., ```groovy VerificationResult result = alice_service.run() { config -> def client = new RESTClient(config.url()) def alice_response = client.get(path: '/mallory') } ``` ### Body DSL For building JSON bodies there is a `PactBodyBuilder` that provides as DSL that includes matching with regular expressions and by types. For a more complete example look at `PactBodyBuilderTest`. For an example: ```groovy service { uponReceiving('a request') withAttributes(method: 'get', path: '/') withBody { name(~/\w+/, 'harry') surname regexp(~/\w+/, 'larry') position regexp(~/staff|contractor/, 'staff') happy(true) } } ``` This will return the following body: ```json { "name": "harry", "surname": "larry", "position": "staff", "happy": true } ``` and add the following matchers: ```json "$.body.name": ["regex": "\\w+"], "$.body.surname": ["regex": "\\w+"], "$.body.position": ["regex": "staff|contractor"] ``` #### DSL Methods The DSL supports the following matching methods: * regexp(Pattern re, String value = null), regexp(String regexp, String value = null) Defines a regular expression matcher. If the value is not provided, a random one will be generated. * hexValue(String value = null) Defines a matcher that accepts hexidecimal values. If the value is not provided, a random hexidcimal value will be generated. * identifier(def value = null) Defines a matcher that accepts integer values. If the value is not provided, a random value will be generated. * ipAddress(String value = null) Defines a matcher that accepts IP addresses. If the value is not provided, a 127.0.0.1 will be used. * numeric(Number value = null) Defines a matcher that accepts any numerical values. If the value is not provided, a random integer will be used. * timestamp(def value = null) Defines a matcher that accepts ISO and SMTP timestamps. If the value is not provided, the current date and time is used. * guid(String value = null) Defines a matcher that accepts UUIDs. A random one will be generated if no value is provided.

Group: au.com.dius Artifact: pact-jvm-consumer-groovy_2.11
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-consumer-groovy_2.11
Group au.com.dius
Version 2.1.2
Last update 26. October 2014
Tags: smtp maven using passed surname supports time matcher something number available content hexidecimal defines pactbuilder executes data states date running timestamp leave side happy current accepts look https define integer needs converted supplied produced artifact starts pactbodybuilder pattern string library groovy_2 assert configuration returned methods expression body harry client good consumer willrespondwith localhost after takes values description alice_response optional parameters instance text execute constructs timestamps contractor examplegroovyconsumerpacttest requestmatchers haspactwith code that generated names require example identifier result matchers response following complete json name withbody types hexidcimal interactions regular provides provider junit hexvalue retrieve there service provided usage numerical server html pacts alice_service github numeric test ipaddress contenttype info given file config central pactbodybuildertest groovy pairs requestdescription regex random interaction like create http verification uuids serviceconsumer then will closure alice bodies addresses weird some provider_state regexp port position realestate invoking query build providerstate version dependencies larry wiki want "null" module mock speak return verificationresult void true access withattributes pactverified method headers little type used upon_receiving dependency requests more request value sets returns responsedata goes succeed status means class expressions restclient 1234 pact responsematchers default matching contain gradle this have uponreceiving state includes scala staff requestdata full path building with definition your into list mallory testcompile guid context group also dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 10
Dependencies unfiltered-netty-server_2.11, scala-library, groovy-all, json4s-native_2.11, dispatch-core_2.11, pact-jvm-consumer_2.11, json4s-jackson_2.11, scala-xml_2.11, scala-logging-slf4j_2.11, slf4j-api,
There are maybe transitive dependencies!

pact-jvm-consumer-groovy_2.11 from group au.com.dius (version 2.1.1)

Group: au.com.dius Artifact: pact-jvm-consumer-groovy_2.11
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-consumer-groovy_2.11
Group au.com.dius
Version 2.1.1


pact-jvm-consumer-groovy_2.11 from group au.com.dius (version 2.1.0)

Group: au.com.dius Artifact: pact-jvm-consumer-groovy_2.11
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-consumer-groovy_2.11
Group au.com.dius
Version 2.1.0


pact-jvm-consumer-groovy_2.11 from group au.com.dius (version 2.0.9)

pact-jvm-consumer-groovy ========================= Groovy DSL for Pact JVM ##Dependency The library is available on maven central using: group-id = `au.com.dius` artifact-id = `pact-jvm-consumer-groovy_2.10` version-id = `2.0.6` ##Usage Add the `pact-jvm-consumer-groovy` library to your test class path. This provides a `PactBuilder` class for you to use to define your pacts. For a full example, have a look at the example JUnit `ExampleGroovyConsumerPactTest`. If you are using gradle for your build, add it to your `build.gradle`: dependencies { testCompile 'au.com.dius:pact-jvm-consumer-groovy_2.10:2.0.6' } Then create an instance of the `PactBuilder` in your test. ```groovy @Test void "A service consumer side of a pact goes a little something like this"() { def alice_service = new PactBuilder() // Create a new PactBuilder alice_service { service_consumer "Consumer" // Define the service consumer by name has_pact_with "Alice Service" // Define the service provider that it has a pact with port 1234 // The port number for the service. It is optional, leave it out to // to use a random one given('there is some good mallory') // defines a provider state. It is optional. upon_receiving('a retrieve Mallory request') // upon_receiving starts a new interaction with(method: 'get', path: '/mallory') // define the request, a GET request to '/mallory' will_respond_with( // define the response we want returned status: 200, headers: ['Content-Type': 'text/html'], body: '"That is some good Mallory."' ) } // Execute the run method to have the mock server run. // It takes a closure to execute your requests and returns a Pact VerificationResult. VerificationResult result = alice_service.run() { def client = new RESTClient('http://localhost:1234/') def alice_response = client.get(path: '/mallory') assert alice_response.status == 200 assert alice_response.contentType == 'text/html' def data = alice_response.data.text() assert data == '"That is some good Mallory."' } assert result == PactVerified$.MODULE$ // This means it is all good in weird Scala speak. } ``` After running this test, the following pact file is produced: { "provider" : { "name" : "Alice Service" }, "consumer" : { "name" : "Consumer" }, "interactions" : [ { "provider_state" : "there is some good mallory", "description" : "a retrieve Mallory request", "request" : { "method" : "get", "path" : "/mallory", "requestMatchers" : { } }, "response" : { "status" : 200, "headers" : { "Content-Type" : "text/html" }, "body" : "That is some good Mallory.", "responseMatchers" : { } } } ], "metadata" : { "pact_gem" : { "version" : "1.0.9" }, "pact-jvm" : { "version" : "2.0-RC6" } } } ### DSL Methods #### service_consumer(String consumer) This names the service consumer for the pact. #### has_pact_with(String provider) This names the service provider for the pact. #### port(int port) Sets the port that the mock server will run on. If not supplied, a random port will be used. #### given(String providerState) Defines a state that the provider needs to be in for the request to succeed. For more info, see https://github.com/realestate-com-au/pact/wiki/Provider-states #### upon_receiving(String requestDescription) Starts the definition of a of a pact interaction. #### with(Map requestData) Defines the request for the interaction. The request data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | method | The HTTP method to use | get | | path | The Path for the request | / | | query | Query parameters as a Map<String, List> | | | headers | Map of key-value pairs for the request headers | | | body | The body of the request. If it is not a string, it will be converted to JSON | | #### will_respond_with(Map responseData) Defines the response for the interaction. The response data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | status | The HTTP status code to return | 200 | | headers | Map of key-value pairs for the response headers | | | body | The body of the response. If it is not a string, it will be converted to JSON | | #### VerificationResult run(Closure closure) The `run` method starts the mock server, and then executes the provided closure. It then returns the pact verification result for the pact run.

Group: au.com.dius Artifact: pact-jvm-consumer-groovy_2.11
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-consumer-groovy_2.11
Group au.com.dius
Version 2.0.9
Last update 06. October 2014
Tags: maven using test contenttype info given file something central groovy pairs requestdescription random number interaction available like create content defines pactbuilder verification http then will closure alice weird some provider_state port executes realestate query data states build running providerstate version has_pact_with leave dependencies side wiki want look https define module mock needs converted return speak void verificationresult will_respond_with supplied produced artifact starts string pactverified groovy_2 library assert method returned methods headers body client little good used consumer type upon_receiving localhost after dependency takes requests more description optional request alice_response value sets parameters service_consumer returns instance metadata responsedata execute text goes succeed status examplegroovyconsumerpacttest pact_gem means class requestmatchers code that restclient 1234 pact responsematchers default names contain gradle example this result have state scala response following requestdata full json name path interactions with definition your provides provider list junit mallory testcompile retrieve there service usage provided server html group pacts alice_service github dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 10
Dependencies unfiltered-netty-server_2.11, scala-library, groovy-all, json4s-native_2.11, dispatch-core_2.11, json4s-jackson_2.11, scala-xml_2.11, scala-logging-slf4j_2.11, pact-jvm-consumer_2.11, slf4j-api,
There are maybe transitive dependencies!

pact-jvm-consumer-groovy_2.11 from group au.com.dius (version 2.0.8)

pact-jvm-consumer-groovy ========================= Groovy DSL for Pact JVM ##Dependency The library is available on maven central using: group-id = `au.com.dius` artifact-id = `pact-jvm-consumer-groovy_2.10` version-id = `2.0.6` ##Usage Add the `pact-jvm-consumer-groovy` library to your test class path. This provides a `PactBuilder` class for you to use to define your pacts. For a full example, have a look at the example JUnit `ExampleGroovyConsumerPactTest`. If you are using gradle for your build, add it to your `build.gradle`: dependencies { testCompile 'au.com.dius:pact-jvm-consumer-groovy_2.10:2.0.6' } Then create an instance of the `PactBuilder` in your test. ```groovy @Test void "A service consumer side of a pact goes a little something like this"() { def alice_service = new PactBuilder() // Create a new PactBuilder alice_service { service_consumer "Consumer" // Define the service consumer by name has_pact_with "Alice Service" // Define the service provider that it has a pact with port 1234 // The port number for the service. It is optional, leave it out to // to use a random one given('there is some good mallory') // defines a provider state. It is optional. upon_receiving('a retrieve Mallory request') // upon_receiving starts a new interaction with(method: 'get', path: '/mallory') // define the request, a GET request to '/mallory' will_respond_with( // define the response we want returned status: 200, headers: ['Content-Type': 'text/html'], body: '"That is some good Mallory."' ) } // Execute the run method to have the mock server run. // It takes a closure to execute your requests and returns a Pact VerificationResult. VerificationResult result = alice_service.run() { def client = new RESTClient('http://localhost:1234/') def alice_response = client.get(path: '/mallory') assert alice_response.status == 200 assert alice_response.contentType == 'text/html' def data = alice_response.data.text() assert data == '"That is some good Mallory."' } assert result == PactVerified$.MODULE$ // This means it is all good in weird Scala speak. } ``` After running this test, the following pact file is produced: { "provider" : { "name" : "Alice Service" }, "consumer" : { "name" : "Consumer" }, "interactions" : [ { "provider_state" : "there is some good mallory", "description" : "a retrieve Mallory request", "request" : { "method" : "get", "path" : "/mallory", "requestMatchers" : { } }, "response" : { "status" : 200, "headers" : { "Content-Type" : "text/html" }, "body" : "That is some good Mallory.", "responseMatchers" : { } } } ], "metadata" : { "pact_gem" : { "version" : "1.0.9" }, "pact-jvm" : { "version" : "2.0-RC6" } } } ### DSL Methods #### service_consumer(String consumer) This names the service consumer for the pact. #### has_pact_with(String provider) This names the service provider for the pact. #### port(int port) Sets the port that the mock server will run on. If not supplied, a random port will be used. #### given(String providerState) Defines a state that the provider needs to be in for the request to succeed. For more info, see https://github.com/realestate-com-au/pact/wiki/Provider-states #### upon_receiving(String requestDescription) Starts the definition of a of a pact interaction. #### with(Map requestData) Defines the request for the interaction. The request data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | method | The HTTP method to use | get | | path | The Path for the request | / | | query | Query parameters as a Map<String, List> | | | headers | Map of key-value pairs for the request headers | | | body | The body of the request. If it is not a string, it will be converted to JSON | | #### will_respond_with(Map responseData) Defines the response for the interaction. The response data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | status | The HTTP status code to return | 200 | | headers | Map of key-value pairs for the response headers | | | body | The body of the response. If it is not a string, it will be converted to JSON | | #### VerificationResult run(Closure closure) The `run` method starts the mock server, and then executes the provided closure. It then returns the pact verification result for the pact run.

Group: au.com.dius Artifact: pact-jvm-consumer-groovy_2.11
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-consumer-groovy_2.11
Group au.com.dius
Version 2.0.8
Last update 29. September 2014
Tags: maven using test contenttype info given file something central groovy pairs requestdescription random number interaction available like create content defines pactbuilder verification http then will closure alice weird some provider_state port executes realestate query data states build running providerstate version has_pact_with leave dependencies side wiki want look https define module mock needs converted return speak void verificationresult will_respond_with supplied produced artifact starts string pactverified groovy_2 library assert method returned methods headers body client little good used consumer type upon_receiving localhost after dependency takes requests more description optional request alice_response value sets parameters service_consumer returns instance metadata responsedata execute text goes succeed status examplegroovyconsumerpacttest pact_gem means class requestmatchers code that restclient 1234 pact responsematchers default names contain gradle example this result have state scala response following requestdata full json name path interactions with definition your provides provider list junit mallory testcompile retrieve there service usage provided server html group pacts alice_service github dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 10
Dependencies unfiltered-netty-server_2.11, scala-library, groovy-all, json4s-native_2.11, dispatch-core_2.11, pact-jvm-consumer_2.11, json4s-jackson_2.11, scala-xml_2.11, scala-logging-slf4j_2.11, slf4j-api,
There are maybe transitive dependencies!

pact-jvm-consumer-groovy_2.11 from group au.com.dius (version 2.0.7)

pact-jvm-consumer-groovy ========================= Groovy DSL for Pact JVM ##Dependency The library is available on maven central using: group-id = `au.com.dius` artifact-id = `pact-jvm-consumer-groovy_2.10` version-id = `2.0.6` ##Usage Add the `pact-jvm-consumer-groovy` library to your test class path. This provides a `PactBuilder` class for you to use to define your pacts. For a full example, have a look at the example JUnit `ExampleGroovyConsumerPactTest`. If you are using gradle for your build, add it to your `build.gradle`: dependencies { testCompile 'au.com.dius:pact-jvm-consumer-groovy_2.10:2.0.6' } Then create an instance of the `PactBuilder` in your test. ```groovy @Test void "A service consumer side of a pact goes a little something like this"() { def alice_service = new PactBuilder() // Create a new PactBuilder alice_service { service_consumer "Consumer" // Define the service consumer by name has_pact_with "Alice Service" // Define the service provider that it has a pact with port 1234 // The port number for the service. It is optional, leave it out to // to use a random one given('there is some good mallory') // defines a provider state. It is optional. upon_receiving('a retrieve Mallory request') // upon_receiving starts a new interaction with(method: 'get', path: '/mallory') // define the request, a GET request to '/mallory' will_respond_with( // define the response we want returned status: 200, headers: ['Content-Type': 'text/html'], body: '"That is some good Mallory."' ) } // Execute the run method to have the mock server run. // It takes a closure to execute your requests and returns a Pact VerificationResult. VerificationResult result = alice_service.run() { def client = new RESTClient('http://localhost:1234/') def alice_response = client.get(path: '/mallory') assert alice_response.status == 200 assert alice_response.contentType == 'text/html' def data = alice_response.data.text() assert data == '"That is some good Mallory."' } assert result == PactVerified$.MODULE$ // This means it is all good in weird Scala speak. } ``` After running this test, the following pact file is produced: { "provider" : { "name" : "Alice Service" }, "consumer" : { "name" : "Consumer" }, "interactions" : [ { "provider_state" : "there is some good mallory", "description" : "a retrieve Mallory request", "request" : { "method" : "get", "path" : "/mallory", "requestMatchers" : { } }, "response" : { "status" : 200, "headers" : { "Content-Type" : "text/html" }, "body" : "That is some good Mallory.", "responseMatchers" : { } } } ], "metadata" : { "pact_gem" : { "version" : "1.0.9" }, "pact-jvm" : { "version" : "2.0-RC6" } } } ### DSL Methods #### service_consumer(String consumer) This names the service consumer for the pact. #### has_pact_with(String provider) This names the service provider for the pact. #### port(int port) Sets the port that the mock server will run on. If not supplied, a random port will be used. #### given(String providerState) Defines a state that the provider needs to be in for the request to succeed. For more info, see https://github.com/realestate-com-au/pact/wiki/Provider-states #### upon_receiving(String requestDescription) Starts the definition of a of a pact interaction. #### with(Map requestData) Defines the request for the interaction. The request data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | method | The HTTP method to use | get | | path | The Path for the request | / | | query | Query parameters as a Map<String, List> | | | headers | Map of key-value pairs for the request headers | | | body | The body of the request. If it is not a string, it will be converted to JSON | | #### will_respond_with(Map responseData) Defines the response for the interaction. The response data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | status | The HTTP status code to return | 200 | | headers | Map of key-value pairs for the response headers | | | body | The body of the response. If it is not a string, it will be converted to JSON | | #### VerificationResult run(Closure closure) The `run` method starts the mock server, and then executes the provided closure. It then returns the pact verification result for the pact run.

Group: au.com.dius Artifact: pact-jvm-consumer-groovy_2.11
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-consumer-groovy_2.11
Group au.com.dius
Version 2.0.7
Last update 24. September 2014
Tags: maven using test contenttype info given file something central groovy pairs requestdescription random number interaction available like create content defines pactbuilder verification http then will closure alice weird some provider_state port executes realestate query data states build running providerstate version has_pact_with leave dependencies side wiki want look https define module mock needs converted return speak void verificationresult will_respond_with supplied produced artifact starts string pactverified groovy_2 library assert method returned methods headers body client little good used consumer type upon_receiving localhost after dependency takes requests more description optional request alice_response value sets parameters service_consumer returns instance metadata responsedata execute text goes succeed status examplegroovyconsumerpacttest pact_gem means class requestmatchers code that restclient 1234 pact responsematchers default names contain gradle example this result have state scala response following requestdata full json name path interactions with definition your provides provider list junit mallory testcompile retrieve there service usage provided server html group pacts alice_service github dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 10
Dependencies slf4j-api, json4s-jackson_2.11, pact-jvm-consumer_2.11, json4s-native_2.11, scala-xml_2.11, groovy-all, scala-library, dispatch-core_2.11, unfiltered-netty-server_2.11, scala-logging-slf4j_2.11,
There are maybe transitive dependencies!

pact-jvm-consumer-groovy_2.11 from group au.com.dius (version 2.0.6)

pact-jvm-consumer-groovy ========================= Groovy DSL for Pact JVM ##Dependency The library is available on maven central using: group-id = `au.com.dius` artifact-id = `pact-jvm-consumer-groovy_2.10` version-id = `2.0.6` ##Usage Add the `pact-jvm-consumer-groovy` library to your test class path. This provides a `PactBuilder` class for you to use to define your pacts. For a full example, have a look at the example JUnit `ExampleGroovyConsumerPactTest`. If you are using gradle for your build, add it to your `build.gradle`: dependencies { testCompile 'au.com.dius:pact-jvm-consumer-groovy_2.10:2.0.1' } Then create an instance of the `PactBuilder` in your test. ```groovy @Test void "A service consumer side of a pact goes a little something like this"() { def alice_service = new PactBuilder() // Create a new PactBuilder alice_service { service_consumer "Consumer" // Define the service consumer by name has_pact_with "Alice Service" // Define the service provider that it has a pact with port 1234 // The port number for the service. It is optional given('there is some good mallory') // defines a provider state. It is optional. upon_receiving('a retrieve Mallory request') // upon_receiving starts a new interaction with(method: 'get', path: '/mallory') // define the request, a GET request to '/mallory' will_respond_with( // define the response we want returned status: 200, headers: ['Content-Type': 'text/html'], body: '"That is some good Mallory."' ) } // Execute the run method to have the mock server run. // It takes a closure to execute your requests and returns a Pact VerificationResult. VerificationResult result = alice_service.run() { def client = new RESTClient('http://localhost:1234/') def alice_response = client.get(path: '/mallory') assert alice_response.status == 200 assert alice_response.contentType == 'text/html' def data = alice_response.data.text() assert data == '"That is some good Mallory."' } assert result == PactVerified$.MODULE$ // This means it is all good in weird Scala speak. } ``` After running this test, the following pact file is produced: { "provider" : { "name" : "Alice Service" }, "consumer" : { "name" : "Consumer" }, "interactions" : [ { "provider_state" : "there is some good mallory", "description" : "a retrieve Mallory request", "request" : { "method" : "get", "path" : "/mallory", "requestMatchers" : { } }, "response" : { "status" : 200, "headers" : { "Content-Type" : "text/html" }, "body" : "That is some good Mallory.", "responseMatchers" : { } } } ], "metadata" : { "pact_gem" : { "version" : "1.0.9" }, "pact-jvm" : { "version" : "2.0-RC6" } } } ### DSL Methods #### service_consumer(String consumer) This names the service consumer for the pact. #### has_pact_with(String provider) This names the service provider for the pact. #### port(int port) Sets the port that the mock server will run on. If not supplied, a random port will be used. #### given(String providerState) Defines a state that the provider needs to be in for the request to succeed. For more info, see https://github.com/realestate-com-au/pact/wiki/Provider-states #### upon_receiving(String requestDescription) Starts the definition of a of a pact interaction. #### with(Map requestData) Defines the request for the interaction. The request data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | method | The HTTP method to use | get | | path | The Path for the request | / | | query | Query parameters as a Map<String, List> | | | headers | Map of key-value pairs for the request headers | | | body | The body of the request. If it is not a string, it will be converted to JSON | | #### will_respond_with(Map responseData) Defines the response for the interaction. The response data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | status | The HTTP status code to return | 200 | | headers | Map of key-value pairs for the response headers | | | body | The body of the response. If it is not a string, it will be converted to JSON | | #### VerificationResult run(Closure closure) The `run` method starts the mock server, and then executes the provided closure. It then returns the pact verification result for the pact run.

Group: au.com.dius Artifact: pact-jvm-consumer-groovy_2.11
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-consumer-groovy_2.11
Group au.com.dius
Version 2.0.6
Last update 23. September 2014
Tags: maven using test contenttype info given file something central groovy pairs requestdescription random number interaction available like create content defines pactbuilder verification http then will closure alice weird some provider_state port executes realestate query data states build running providerstate version has_pact_with dependencies side wiki want look https define module mock needs converted return speak void verificationresult will_respond_with supplied produced artifact starts string pactverified groovy_2 library assert method returned methods headers body client little good used consumer type upon_receiving localhost after dependency takes requests more description optional request alice_response value sets parameters service_consumer returns instance metadata responsedata execute text goes succeed status examplegroovyconsumerpacttest pact_gem means class requestmatchers code that restclient 1234 pact responsematchers default names contain gradle example this result have state scala response following requestdata full json name path interactions with definition your provides provider list junit mallory testcompile retrieve there service usage provided server html group pacts alice_service github dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 10
Dependencies slf4j-api, json4s-jackson_2.11, json4s-native_2.11, scala-xml_2.11, groovy-all, scala-library, dispatch-core_2.11, pact-jvm-consumer_2.11, unfiltered-netty-server_2.11, scala-logging-slf4j_2.11,
There are maybe transitive dependencies!

pact-jvm-consumer-groovy_2.11 from group au.com.dius (version 2.0.5)

pact-jvm-consumer-groovy ========================= Groovy DSL for Pact JVM ##Dependency The library is available on maven central using: group-id = `au.com.dius` artifact-id = `pact-jvm-consumer-groovy_2.10` version-id = `2.0.1` ##Usage Add the `pact-jvm-consumer-groovy` library to your test class path. This provides a `PactBuilder` class for you to use to define your pacts. For a full example, have a look at the example JUnit `ExampleGroovyConsumerPactTest`. If you are using gradle for your build, add it to your `build.gradle`: dependencies { testCompile 'au.com.dius:pact-jvm-consumer-groovy_2.10:2.0.1' } Then create an instance of the `PactBuilder` in your test. ```groovy @Test void "A service consumer side of a pact goes a little something like this"() { def alice_service = new PactBuilder() // Create a new PactBuilder alice_service { service_consumer "Consumer" // Define the service consumer by name has_pact_with "Alice Service" // Define the service provider that it has a pact with port 1234 // The port number for the service. It is optional given('there is some good mallory') // defines a provider state. It is optional. upon_receiving('a retrieve Mallory request') // upon_receiving starts a new interaction with(method: 'get', path: '/mallory') // define the request, a GET request to '/mallory' will_respond_with( // define the response we want returned status: 200, headers: ['Content-Type': 'text/html'], body: '"That is some good Mallory."' ) } // Execute the run method to have the mock server run. // It takes a closure to execute your requests and returns a Pact VerificationResult. VerificationResult result = alice_service.run() { def client = new RESTClient('http://localhost:1234/') def alice_response = client.get(path: '/mallory') assert alice_response.status == 200 assert alice_response.contentType == 'text/html' def data = alice_response.data.text() assert data == '"That is some good Mallory."' } assert result == PactVerified$.MODULE$ // This means it is all good in weird Scala speak. } ``` After running this test, the following pact file is produced: { "provider" : { "name" : "Alice Service" }, "consumer" : { "name" : "Consumer" }, "interactions" : [ { "provider_state" : "there is some good mallory", "description" : "a retrieve Mallory request", "request" : { "method" : "get", "path" : "/mallory", "requestMatchers" : { } }, "response" : { "status" : 200, "headers" : { "Content-Type" : "text/html" }, "body" : "That is some good Mallory.", "responseMatchers" : { } } } ], "metadata" : { "pact_gem" : { "version" : "1.0.9" }, "pact-jvm" : { "version" : "2.0-RC6" } } } ### DSL Methods #### service_consumer(String consumer) This names the service consumer for the pact. #### has_pact_with(String provider) This names the service provider for the pact. #### port(int port) Sets the port that the mock server will run on. If not supplied, a random port will be used. #### given(String providerState) Defines a state that the provider needs to be in for the request to succeed. For more info, see https://github.com/realestate-com-au/pact/wiki/Provider-states #### upon_receiving(String requestDescription) Starts the definition of a of a pact interaction. #### with(Map requestData) Defines the request for the interaction. The request data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | method | The HTTP method to use | get | | path | The Path for the request | / | | query | Query parameters as a Map<String, List> | | | headers | Map of key-value pairs for the request headers | | | body | The body of the request. If it is not a string, it will be converted to JSON | | #### will_respond_with(Map responseData) Defines the response for the interaction. The response data map can contain the following: | key | Description | Default Value | |----------------------------|-------------------------------------------|-----------------------------| | status | The HTTP status code to return | 200 | | headers | Map of key-value pairs for the response headers | | | body | The body of the response. If it is not a string, it will be converted to JSON | | #### VerificationResult run(Closure closure) The `run` method starts the mock server, and then executes the provided closure. It then returns the pact verification result for the pact run.

Group: au.com.dius Artifact: pact-jvm-consumer-groovy_2.11
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-consumer-groovy_2.11
Group au.com.dius
Version 2.0.5
Last update 22. September 2014
Tags: maven using test contenttype info given file something central groovy pairs requestdescription random number interaction available like create content defines pactbuilder verification http then will closure alice weird some provider_state port executes realestate query data states build running providerstate version has_pact_with dependencies side wiki want look https define module mock needs converted return speak void verificationresult will_respond_with supplied produced artifact starts string pactverified groovy_2 library assert method returned methods headers body client little good used consumer type upon_receiving localhost after dependency takes requests more description optional request alice_response value sets parameters service_consumer returns instance metadata responsedata execute text goes succeed status examplegroovyconsumerpacttest pact_gem means class requestmatchers code that restclient 1234 pact responsematchers default names contain gradle example this result have state scala response following requestdata full json name path interactions with definition your provides provider list junit mallory testcompile retrieve there service usage provided server html group pacts alice_service github dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 10
Dependencies slf4j-api, json4s-jackson_2.11, json4s-native_2.11, scala-xml_2.11, groovy-all, scala-library, dispatch-core_2.11, pact-jvm-consumer_2.11, unfiltered-netty-server_2.11, scala-logging-slf4j_2.11,
There are maybe transitive dependencies!

pact-jvm-consumer-groovy_2.11 from group au.com.dius (version 2.0.4)

Group: au.com.dius Artifact: pact-jvm-consumer-groovy_2.11
Show documentation Show source 
 

0 downloads
Artifact pact-jvm-consumer-groovy_2.11
Group au.com.dius
Version 2.0.4




Page 14 from 15 (items total 144)


© 2015 - 2024 Weber Informatics LLC | Privacy Policy