pact-jvm-model

Pact model ========== The model project is responsible for providing: * a model to represent pacts * serialization and deserialization * comparison between two parts of the pact model * conversion between the pact model and whatever third party libraries used by the pact-consumer and pact-provider requires You should never need to include this project directly

License

License

GroupId

GroupId

au.com.dius
ArtifactId

ArtifactId

pact-jvm-model
Last Version

Last Version

3.6.15
Release Date

Release Date

Type

Type

jar
Description

Description

pact-jvm-model
Pact model ========== The model project is responsible for providing: * a model to represent pacts * serialization and deserialization * comparison between two parts of the pact model * conversion between the pact model and whatever third party libraries used by the pact-consumer and pact-provider requires You should never need to include this project directly
Project URL

Project URL

https://github.com/DiUS/pact-jvm
Source Code Management

Source Code Management

https://github.com/DiUS/pact-jvm

Download pact-jvm-model

How to add to project

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

Dependencies

compile (8)

Group / Artifact Type Version
au.com.dius : pact-jvm-support jar 3.6.15
au.com.dius : pact-jvm-pact-broker jar 3.6.15
com.github.zafarkhaja : java-semver jar 0.9.0
org.apache.commons : commons-collections4 jar 4.1
com.github.mifmif : generex jar 1.0.2
javax.mail : mail jar 1.5.0-b01
org.jetbrains.kotlin : kotlin-reflect jar 1.3.71
com.michael-bull.kotlin-result : kotlin-result jar 1.1.6

runtime (4)

Group / Artifact Type Version
com.amazonaws : aws-java-sdk-s3 jar 1.11.587
org.slf4j : slf4j-api jar 1.7.26
com.google.code.gson : gson jar 2.8.6
com.github.salomonbrys.kotson : kotson jar 2.5.0

test (10)

Group / Artifact Type Version
org.hamcrest : hamcrest jar 2.1
org.spockframework : spock-core jar 1.3-groovy-2.5
net.bytebuddy : byte-buddy jar 1.9.13
org.objenesis : objenesis jar 3.0.1
org.codehaus.groovy : groovy jar 2.5.6
ch.qos.logback : logback-classic jar 1.2.3
org.codehaus.groovy.modules.http-builder : http-builder jar 0.7.1
org.codehaus.groovy : groovy-datetime jar 2.5.6
io.kotlintest : kotlintest jar 2.0.7
au.com.dius : pact-jvm-model jar 3.6.15

Project Modules

There are no modules declared in this project.

pact-jvm

Pact-JVM Build Maven Central

JVM implementation of the consumer driven contract library pact.

From the Ruby Pact website:

Define a pact between service consumers and providers, enabling "consumer driven contract" testing.

Pact provides an RSpec DSL for service consumers to define the HTTP requests they will make to a service provider and the HTTP responses they expect back. These expectations are used in the consumers specs to provide a mock service provider. The interactions are recorded, and played back in the service provider specs to ensure the service provider actually does provide the response the consumer expects.

This allows testing of both sides of an integration point using fast unit tests.

This gem is inspired by the concept of "Consumer driven contracts". See https://martinfowler.com/articles/consumerDrivenContracts.html for more information.

Read Getting started with Pact for more information on how to get going.

Contact

Links

Tutorial (60 minutes)

Learn everything in Pact in 60 minutes: https://github.com/DiUS/pact-workshop-jvm.

The workshop takes you through all of the key concepts of consumer and provider testing using a Spring boot application.

Documentation

Additional documentation can be found at docs.pact.io, in the Pact Wiki, and in the Pact-JVM wiki. Stack Overflow is also a good source of help.

Supported JDK and specification versions:

Branch Specification JDK Kotlin Version Scala Versions Latest Version
4.2.x V4* 11+ 1.4.10 N/A 4.2.0-beta.1
4.1.x V3 8-12 1.3.72 N/A 4.1.11
4.0.x V3 8-12 1.3.71 N/A 4.0.10
3.6.x V3 8 1.3.71 2.12 3.6.15
3.5.x V3 8 1.1.4-2 2.12, 2.11 3.5.25
3.5.x-jre7 V3 7 1.1.4-2 2.11 3.5.7-jre7.0
2.4.x V2 6 N/A 2.10, 2.11 2.4.20

NOTE: V4 specification support is a work in progress. See Pact V4 RFC.

NOTE: The JARs produced by this project have changed with 4.1.x to better align with Java 9 JPMS. The artefacts are now:

au.com.dius.pact:consumer
au.com.dius.pact.consumer:groovy
au.com.dius.pact.consumer:junit
au.com.dius.pact.consumer:junit5
au.com.dius.pact.consumer:java8
au.com.dius.pact.consumer:specs2_2.13
au.com.dius.pact:pact-jvm-server
au.com.dius.pact:provider
au.com.dius.pact.provider:scalatest_2.13
au.com.dius.pact.provider:spring
au.com.dius.pact.provider:maven
au.com.dius.pact:provider
au.com.dius.pact.provider:junit
au.com.dius.pact.provider:junit5
au.com.dius.pact.provider:scalasupport_2.13
au.com.dius.pact.provider:lein
au.com.dius.pact.provider:gradle
au.com.dius.pact.provider:specs2_2.13
au.com.dius.pact.provider:junit5spring
au.com.dius.pact.core:support
au.com.dius.pact.core:model
au.com.dius.pact.core:matchers
au.com.dius.pact.core:pactbroker

Service Consumers

Pact-JVM has a number of ways you can write your service consumer tests.

I Use Scala

You want to look at: scala-pact or specs2

I Use Java

You want to look at: junit for JUnit 4 tests and junit5 for JUnit 5 tests. Also, if you are using Java 8, there is an updated DSL for consumer tests.

I Use Groovy or Grails

You want to look at: groovy or junit

(Use Clojure I)

Clojure can call out to Java, so have a look at junit. For an example look at example_clojure_consumer_pact_test.clj.

I Use some other jvm language or test framework

You want to look at: Consumer

My Consumer interacts with a Message Queue

As part of the V3 pact specification, we have defined a new pact file for interactions with message queues. For an implementation of a Groovy consumer test with a message pact, have a look at PactMessageBuilderSpec.groovy.

Service Providers

Once you have run your consumer tests, you will have generated some Pact files. You can then verify your service providers with these files.

I am writing a provider and want to ...

verify pacts with SBT

You want to look at: scala-pact

verify pacts with Gradle

You want to look at: pact gradle plugin

verify pacts with Maven

You want to look at: pact maven plugin

verify pacts with JUnit tests

You want to look at: junit provider support for JUnit 4 tests and junit5 for JUnit 5 tests

verify pacts with Leiningen

You want to look at: pact leiningen plugin

verify pacts with Specs2

Have a look at specs2

verify pacts with a Spring MVC project

Have a look at spring or Spring MVC Pact Test Runner (Not maintained).

I want to verify pacts but don't want to use sbt or gradle or leiningen

You want to look at: provider

verify interactions with a message queue

As part of the V3 pact specification, we have defined a new pact file for interactions with message queues. The Gradle pact plugin supports a mechanism where you can verify V3 message pacts, have a look at pact gradle plugin. The JUnit pact library also supports verification of V3 message pacts, have a look at junit.

I Use Ruby or Go or something else

The pact-jvm libraries are pure jvm technologies and do not have any native dependencies.

However if you have a ruby provider, the json produced by this library is compatible with the ruby pact library. You'll want to look at: Ruby Pact.

For .Net, there is Pact-net.

For JS, there is Pact-JS.

For Go, there is Pact-go.

Have a look at implementations in other languages.

I Use something completely different

There's a limit to how much we can help, however check out pact-jvm-server

How do I transport my pacts from consumers to providers?

You want to look at: Pact Broker

Which is a project that aims at providing tooling to coordinate pact generation and delivery between projects.

I want to contribute

Documentation for contributors is here.

au.com.dius

DiUS Computing Pty Ltd

Versions

Version
3.6.15
3.6.14
3.6.13
3.6.12
3.6.11
3.6.10
3.6.9
3.6.8
3.6.7
3.6.6
3.6.5
3.6.4
3.6.3
3.6.2
3.6.1
3.6.0
3.6.0-rc.1
3.6.0-rc.0
3.5.25
3.5.24
3.5.23
3.5.22
3.5.21
3.5.20
3.5.19
3.5.18
3.5.17
3.5.16
3.5.15
3.5.14
3.5.13
3.5.12
3.5.11
3.5.10
3.5.9
3.5.8
3.5.7-jre7.0
3.5.7
3.5.6-jre7.0
3.5.6
3.5.5-jre7.0
3.5.5
3.5.4-jre7.0
3.5.4
3.5.3-jre7.0
3.5.3
3.5.2-jre7.0
3.5.2
3.5.1-jre7.1
3.5.1
3.5.0-jre7.1
3.5.0-jre7
3.5.0
3.5.0-rc.3
3.5.0-rc.2
3.5.0-rc.1
3.5.0-beta.4
3.5.0-beta.3
3.5.0-beta.2
3.5.0-beta.1
3.4.1
3.4.0
3.3.10
3.3.9
3.3.8
3.3.7
3.3.6
3.3.5
3.3.4
3.3.3
3.3.2
3.3.1
3.3.0
2.5.0-beta.0
2.4.20
2.4.19
2.4.18
2.4.17
2.4.16