diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.gitignore b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.gitignore
new file mode 100644
index 0000000000..2c95b068c5
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.gitignore
@@ -0,0 +1,13 @@
+.idea/
+*.iml
+/target
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+
+target
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.mvn/codesigning.asc.enc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.mvn/codesigning.asc.enc
new file mode 100644
index 0000000000..da867ac9b1
Binary files /dev/null and b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.mvn/codesigning.asc.enc differ
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.mvn/wrapper/maven-wrapper.properties b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000000..6637cedb28
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.travis.yml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.travis.yml
new file mode 100644
index 0000000000..7d7bc617b2
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/.travis.yml
@@ -0,0 +1,5 @@
+language: java
+jdk:
+- oraclejdk8
+script:
+- ./mvnw clean test jacoco:report coveralls:report -pl spring-cloud-contract-verifier-maven-plugin
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/LICENSE.md b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/LICENSE.md
new file mode 100644
index 0000000000..74640422d1
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/LICENSE.md
@@ -0,0 +1,194 @@
+Apache License
+==============
+
+_Version 2.0, January 2004_
+_<>_
+
+### Terms and Conditions for use, reproduction, and distribution
+
+#### 1. Definitions
+
+“License” shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.
+
+“Licensor” shall mean the copyright owner or entity authorized by the copyright
+owner that is granting the License.
+
+“Legal Entity” shall mean the union of the acting entity and all other entities
+that control, are controlled by, or are under common control with that entity.
+For the purposes of this definition, “control” means **(i)** the power, direct or
+indirect, to cause the direction or management of such entity, whether by
+contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
+outstanding shares, or **(iii)** beneficial ownership of such entity.
+
+“You” (or “Your”) shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+
+“Source” form shall mean the preferred form for making modifications, including
+but not limited to software source code, documentation source, and configuration
+files.
+
+“Object” form shall mean any form resulting from mechanical transformation or
+translation of a Source form, including but not limited to compiled object code,
+generated documentation, and conversions to other media types.
+
+“Work” shall mean the work of authorship, whether in Source or Object form, made
+available under the License, as indicated by a copyright notice that is included
+in or attached to the work (an example is provided in the Appendix below).
+
+“Derivative Works” shall mean any work, whether in Source or Object form, that
+is based on (or derived from) the Work and for which the editorial revisions,
+annotations, elaborations, or other modifications represent, as a whole, an
+original work of authorship. For the purposes of this License, Derivative Works
+shall not include works that remain separable from, or merely link (or bind by
+name) to the interfaces of, the Work and Derivative Works thereof.
+
+“Contribution” shall mean any work of authorship, including the original version
+of the Work and any modifications or additions to that Work or Derivative Works
+thereof, that is intentionally submitted to Licensor for inclusion in the Work
+by the copyright owner or by an individual or Legal Entity authorized to submit
+on behalf of the copyright owner. For the purposes of this definition,
+“submitted” means any form of electronic, verbal, or written communication sent
+to the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control systems, and
+issue tracking systems that are managed by, or on behalf of, the Licensor for
+the purpose of discussing and improving the Work, but excluding communication
+that is conspicuously marked or otherwise designated in writing by the copyright
+owner as “Not a Contribution.”
+
+“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
+of whom a Contribution has been received by Licensor and subsequently
+incorporated within the Work.
+
+#### 2. Grant of Copyright License
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.
+
+#### 3. Grant of Patent License
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable (except as stated in this section) patent license to make, have
+made, use, offer to sell, sell, import, and otherwise transfer the Work, where
+such license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by combination
+of their Contribution(s) with the Work to which such Contribution(s) was
+submitted. If You institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work or a
+Contribution incorporated within the Work constitutes direct or contributory
+patent infringement, then any patent licenses granted to You under this License
+for that Work shall terminate as of the date such litigation is filed.
+
+#### 4. Redistribution
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof
+in any medium, with or without modifications, and in Source or Object form,
+provided that You meet the following conditions:
+
+* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
+this License; and
+* **(b)** You must cause any modified files to carry prominent notices stating that You
+changed the files; and
+* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
+all copyright, patent, trademark, and attribution notices from the Source form
+of the Work, excluding those notices that do not pertain to any part of the
+Derivative Works; and
+* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
+Derivative Works that You distribute must include a readable copy of the
+attribution notices contained within such NOTICE file, excluding those notices
+that do not pertain to any part of the Derivative Works, in at least one of the
+following places: within a NOTICE text file distributed as part of the
+Derivative Works; within the Source form or documentation, if provided along
+with the Derivative Works; or, within a display generated by the Derivative
+Works, if and wherever such third-party notices normally appear. The contents of
+the NOTICE file are for informational purposes only and do not modify the
+License. You may add Your own attribution notices within Derivative Works that
+You distribute, alongside or as an addendum to the NOTICE text from the Work,
+provided that such additional attribution notices cannot be construed as
+modifying the License.
+
+You may add Your own copyright statement to Your modifications and may provide
+additional or different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works as a whole,
+provided Your use, reproduction, and distribution of the Work otherwise complies
+with the conditions stated in this License.
+
+#### 5. Submission of Contributions
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted
+for inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the terms of
+any separate license agreement you may have executed with Licensor regarding
+such Contributions.
+
+#### 6. Trademarks
+
+This License does not grant permission to use the trade names, trademarks,
+service marks, or product names of the Licensor, except as required for
+reasonable and customary use in describing the origin of the Work and
+reproducing the content of the NOTICE file.
+
+#### 7. Disclaimer of Warranty
+
+Unless required by applicable law or agreed to in writing, Licensor provides the
+Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+including, without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
+solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise of
+permissions under this License.
+
+#### 8. Limitation of Liability
+
+In no event and under no legal theory, whether in tort (including negligence),
+contract, or otherwise, unless required by applicable law (such as deliberate
+and grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special, incidental,
+or consequential damages of any character arising as a result of this License or
+out of the use or inability to use the Work (including but not limited to
+damages for loss of goodwill, work stoppage, computer failure or malfunction, or
+any and all other commercial damages or losses), even if such Contributor has
+been advised of the possibility of such damages.
+
+#### 9. Accepting Warranty or Additional Liability
+
+While redistributing the Work or Derivative Works thereof, You may choose to
+offer, and charge a fee for, acceptance of support, warranty, indemnity, or
+other liability obligations and/or rights consistent with this License. However,
+in accepting such obligations, You may act only on Your own behalf and on Your
+sole responsibility, not on behalf of any other Contributor, and only if You
+agree to indemnify, defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason of your
+accepting any such warranty or additional liability.
+
+_END OF TERMS AND CONDITIONS_
+
+### APPENDIX: How to apply the Apache License to your work
+
+To apply the Apache License to your work, attach the following boilerplate
+notice, with the fields enclosed by brackets `[]` replaced with your own
+identifying information. (Don't include the brackets!) The text should be
+enclosed in the appropriate comment syntax for the file format. We also
+recommend that a file or class name and description of purpose be included on
+the same “printed page” as the copyright notice for easier identification within
+third-party archives.
+
+ Copyright 2016 Codearte
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/README.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/README.adoc
new file mode 100644
index 0000000000..ccd77f7328
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/README.adoc
@@ -0,0 +1,60 @@
+// Do not edit this file (e.g. go instead to src/main/asciidoc)
+
+image::https://travis-ci.org/Codearte/accurest-maven-plugin.svg?branch=master[Build Status, link=https://travis-ci.org/Codearte/accurest-maven-plugin]
+image::https://img.shields.io/github/issues/Codearte/accurest/maven.svg[Github Issues, link=https://github.com/Codearte/accurest/labels/maven]
+
+//[](https://maven-badges.herokuapp.com/maven-central/io.codearte.accurest/accurest-maven-plugin)
+
+= Spring Cloud Contract Verifier Maven Plugin
+
+== Documentation
+
+* http://codearte.github.io/accurest/[Spring Cloud Contract Verifier Documentation]
+* http://codearte.github.io/accurest-maven-plugin/plugin-info.html[Spring Cloud Contract Verifier Maven Plugin Documentation Site]
+
+== Contributing
+
+Spring Cloud is released under the non-restrictive Apache 2.0 license,
+and follows a very standard Github development process, using Github
+tracker for issues and merging pull requests into master. If you want
+to contribute even something trivial please do not hesitate, but
+follow the guidelines below.
+
+=== Sign the Contributor License Agreement
+Before we accept a non-trivial patch or pull request we will need you to sign the
+https://support.springsource.com/spring_committer_signup[contributor's agreement].
+Signing the contributor's agreement does not grant anyone commit rights to the main
+repository, but it does mean that we can accept your contributions, and you will get an
+author credit if we do. Active contributors might be asked to join the core team, and
+given the ability to merge pull requests.
+
+=== Code of Conduct
+This project adheres to the Contributor Covenant https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc[code of
+conduct]. By participating, you are expected to uphold this code. Please report
+unacceptable behavior to spring-code-of-conduct@pivotal.io.
+
+=== Code Conventions and Housekeeping
+None of these is essential for a pull request, but they will all help. They can also be
+added after the original pull request but before a merge.
+
+* Use the Spring Framework code format conventions. If you use Eclipse
+ you can import formatter settings using the
+ `eclipse-code-formatter.xml` file from the
+ https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring
+ Cloud Build] project. If using IntelliJ, you can use the
+ http://plugins.jetbrains.com/plugin/6546[Eclipse Code Formatter
+ Plugin] to import the same file.
+* Make sure all new `.java` files to have a simple Javadoc class comment with at least an
+ `@author` tag identifying you, and preferably at least a paragraph on what the class is
+ for.
+* Add the ASF license header comment to all new `.java` files (copy from existing files
+ in the project)
+* Add yourself as an `@author` to the .java files that you modify substantially (more
+ than cosmetic changes).
+* Add some Javadocs and, if you change the namespace, some XSD doc elements.
+* A few unit tests would help a lot as well -- someone has to do it.
+* If no-one else is using your branch, please rebase it against the current master (or
+ other target branch in the main project).
+* When writing a commit message please follow http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions],
+ if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit
+ message (where XXXX is the issue number).
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/pom.xml
new file mode 100644
index 0000000000..1c02de1ddb
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/pom.xml
@@ -0,0 +1,57 @@
+
+
+ 4.0.0
+
+ org.springframework.cloud
+ spring-cloud-build
+ 1.1.1.RELEASE
+
+
+
+ spring-cloud-contract-verifier-docs
+ pom
+ Spring Cloud Contract Verifier Docs
+ Spring Contract Verifier Docs
+ 1.0.0.BUILD-SNAPSHOT
+
+ spring-cloud-contract-verifier-maven-plugin
+ ${basedir}/..
+
+
+
+ docs
+
+
+
+ org.asciidoctor
+ asciidoctor-maven-plugin
+ 1.5.3
+ false
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+ false
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ false
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+
+
+
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/src/main/asciidoc/README.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/src/main/asciidoc/README.adoc
new file mode 100644
index 0000000000..ac49eb468b
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/src/main/asciidoc/README.adoc
@@ -0,0 +1,15 @@
+image::https://travis-ci.org/Codearte/accurest-maven-plugin.svg?branch=master[Build Status, link=https://travis-ci.org/Codearte/accurest-maven-plugin]
+image::https://img.shields.io/github/issues/Codearte/accurest/maven.svg[Github Issues, link=https://github.com/Codearte/accurest/labels/maven]
+
+//[](https://maven-badges.herokuapp.com/maven-central/io.codearte.accurest/accurest-maven-plugin)
+
+= Spring Cloud Contract Verifier Maven Plugin
+
+== Documentation
+
+* http://codearte.github.io/accurest/[Spring Cloud Contract Verifier Documentation]
+* http://codearte.github.io/accurest-maven-plugin/plugin-info.html[Spring Cloud Contract Verifier Maven Plugin Documentation Site]
+
+== Contributing
+
+include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/src/main/asciidoc/spring-cloud-contract-verifier-maven-plugin.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/src/main/asciidoc/spring-cloud-contract-verifier-maven-plugin.adoc
new file mode 100644
index 0000000000..b2fd89ebfd
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/src/main/asciidoc/spring-cloud-contract-verifier-maven-plugin.adoc
@@ -0,0 +1,3 @@
+:root_folder: ../../../../spring-cloud-contract-verifier-maven-plugin
+
+include::{root_folder}/src/site/asciidoc/complex-content.adoc[]
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/src/main/ruby/generate_readme.sh b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/src/main/ruby/generate_readme.sh
new file mode 100755
index 0000000000..6d0ce9dc54
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/docs/src/main/ruby/generate_readme.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env ruby
+
+base_dir = File.join(File.dirname(__FILE__),'../../..')
+src_dir = File.join(base_dir, "/src/main/asciidoc")
+require 'asciidoctor'
+require 'optparse'
+
+options = {}
+file = "#{src_dir}/README.adoc"
+
+OptionParser.new do |o|
+ o.on('-o OUTPUT_FILE', 'Output file (default is stdout)') { |file| options[:to_file] = file unless file=='-' }
+ o.on('-h', '--help') { puts o; exit }
+ o.parse!
+end
+
+file = ARGV[0] if ARGV.length>0
+
+# Copied from https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/scripts/asciidoc-coalescer.rb
+doc = Asciidoctor.load_file file, safe: :unsafe, header_only: true, attributes: options[:attributes]
+header_attr_names = (doc.instance_variable_get :@attributes_modified).to_a
+header_attr_names.each {|k| doc.attributes[%(#{k}!)] = '' unless doc.attr? k }
+attrs = doc.attributes
+attrs['allow-uri-read'] = true
+puts attrs
+
+out = "// Do not edit this file (e.g. go instead to src/main/asciidoc)\n\n"
+doc = Asciidoctor.load_file file, safe: :unsafe, parse: false, attributes: attrs
+out << doc.reader.read
+
+unless options[:to_file]
+ puts out
+else
+ File.open(options[:to_file],'w+') do |file|
+ file.write(out)
+ end
+end
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/mvnw b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/mvnw
new file mode 100755
index 0000000000..349bef124b
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/mvnw
@@ -0,0 +1,243 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven2 Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+VERSION=$(awk '/ 0) {$0=$0} 1' `dirname $0`/pom.xml| grep '\(.*\)<.*/\1/')
+if echo $VERSION | egrep -q 'M|RC'; then
+ echo Activating \"milestone\" profile for version=\"$VERSION\"
+ echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pmilestone"
+else
+ echo Deactivating \"milestone\" profile for version=\"$VERSION\"
+ echo $MAVEN_ARGS | grep -q milestone && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pmilestone//')
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ #
+ # Look for the Apple JDKs first to preserve the existing behaviour, and then look
+ # for the new JDKs provided by Oracle.
+ #
+ if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
+ #
+ # Apple JDKs
+ #
+ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
+ fi
+
+ if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
+ #
+ # Apple JDKs
+ #
+ export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
+ fi
+
+ if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
+ #
+ # Oracle JDKs
+ #
+ export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
+ fi
+
+ if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
+ #
+ # Apple JDKs
+ #
+ export JAVA_HOME=`/usr/libexec/java_home`
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Migwn, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+ # TODO classpath?
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`which java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+fi
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+ local basedir=$(pwd)
+ local wdir=$(pwd)
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ wdir=$(cd "$wdir/.."; pwd)
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} ${MAVEN_ARGS} "$@"
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/mvnw.cmd b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/mvnw.cmd
new file mode 100644
index 0000000000..001048081d
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/mvnw.cmd
@@ -0,0 +1,145 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven2 Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %*
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+
+set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar""
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/pom.xml
new file mode 100644
index 0000000000..2139d3fc35
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/pom.xml
@@ -0,0 +1,151 @@
+
+
+ 4.0.0
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-maven-plugin-parent
+ pom
+ 1.0.0.BUILD-SNAPSHOT
+
+ Spring Cloud Contract Verifier Maven Plugin
+ Spring Cloud Contract Verifier Maven Plugin Parent
+ https://github.com/Codearte/accurest-maven-plugin
+
+ 2016
+
+
+ docs
+ spring-cloud-contract-verifier-maven-plugin
+
+
+
+ [3.2.1,)
+
+
+
+ Codearte
+ http://codearte.io/
+
+
+
+
+ mariuszs
+ Mariusz Smykula
+ mariuszs@gmail.com
+
+
+ marcingrzejszczak
+ Marcin Grzejszczak
+ marcin@grzejszczak.pl
+
+
+
+
+
+ Apache 2
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+ A business-friendly OSS license
+
+
+
+
+ scm:git:https://github.com/Codearte/accurest-maven-plugin.git
+ scm:git:git@github.com:Codearte/accurest-maven-plugin.git
+ https://github.com/Codearte/accurest-maven-plugin
+ HEAD
+
+
+
+ GitHub Issues
+ https://github.com/Codearte/accurest/labels/maven
+
+
+
+ Travis
+ https://travis-ci.org/Codearte/accurest-maven-plugin
+
+
+
+
+
+
+ org.codehaus.gmavenplus
+ gmavenplus-plugin
+ 1.5
+
+
+ org.codehaus.plexus
+ plexus-component-metadata
+ 1.6
+
+
+ maven-plugin-plugin
+ ${maven.plugin.plugin.version}
+
+
+ io.takari.maven.plugins
+ takari-lifecycle-plugin
+ 1.12.0
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 2.19.1
+
+
+ com.mycila
+ license-maven-plugin
+ 3.0.rc1
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.7.6.201602180812
+
+
+ org.eluder.coveralls
+ coveralls-maven-plugin
+ 4.1.0
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 2.5.3
+
+
+ org.apache.maven.plugins
+ maven-scm-publish-plugin
+ 1.1
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+ 3.4
+
+
+ maven-install-plugin
+ 2.5.2
+
+
+ maven-source-plugin
+ 3.0.0
+
+
+ maven-javadoc-plugin
+ 2.10.3
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+
+
+
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/pom.xml
new file mode 100644
index 0000000000..17d3dfe4d6
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/pom.xml
@@ -0,0 +1,473 @@
+
+
+ 4.0.0
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-maven-plugin
+ maven-plugin
+ 1.0.0.BUILD-SNAPSHOT
+
+ Spring Cloud Contract Verifier Maven Plugin
+ Spring Cloud Contract Verifier Maven Plugin
+ https://github.com/Codearte/accurest-maven-plugin
+
+
+ 3.2.5
+ 3.4
+
+ UTF-8
+ UTF-8
+
+ 1.0.0.BUILD-SNAPSHOT
+ 1.1.0
+
+ 1.7
+ 1.7
+
+
+ 2016
+
+
+
+ repo.spring.io
+ Spring Release Repository
+ https://repo.spring.io/plugins-release-local
+
+
+ repo.spring.io
+ Spring Snapshot Repository
+ https://repo.spring.io/plugins-snapshot-local
+
+
+ github
+ scm:git:ssh://git@github.com:Codearte/accurest-maven-plugin.git
+
+
+
+
+
+
+ org.codehaus.gmavenplus
+ gmavenplus-plugin
+
+
+
+ addSources
+ generateStubs
+ compile
+ removeStubs
+
+
+
+
+
+ org.codehaus.plexus
+ plexus-component-metadata
+
+
+
+ generate-metadata
+ generate-test-metadata
+
+
+
+
+
+ maven-plugin-plugin
+
+ true
+
+
+
+ generated-helpmojo
+
+ helpmojo
+
+
+
+ generate-descriptor
+
+ descriptor
+
+
+
+
+
+ io.takari.maven.plugins
+ takari-lifecycle-plugin
+ true
+
+
+ testProperties
+ process-test-resources
+
+ testProperties
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+ com.mycila
+ license-maven-plugin
+
+ src/etc/header.txt
+
+ src/**
+
+
+ **/.idea/**
+ **/*.adoc
+
+ true
+ true
+
+ ${project.inceptionYear}
+ Codearte
+
+ UTF-8
+
+
+
+
+ check
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+
+
+ **/HelpMojo.class
+
+
+
+
+ prepare-agent
+
+ prepare-agent
+
+
+
+
+
+ org.eluder.coveralls
+ coveralls-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+
+ false
+ true
+ v@{project.version}
+
+
+
+ org.apache.maven.plugins
+ maven-scm-publish-plugin
+
+ ${project.scm.developerConnection}
+ gh-pages
+ ${project.reporting.outputDirectory}
+
+
+
+ scm-publish
+ site-deploy
+
+ publish-scm
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+
+ true
+
+ true
+ true
+ false
+ en
+ UTF-8
+ UTF-8
+
+
+
+ font
+ coderay
+ style
+ 2
+
+
+
+
+
+ org.asciidoctor
+ asciidoctor-maven-plugin
+ 1.5.3
+
+
+
+
+
+
+
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-core
+ ${spring.cloud.contract.verifier.version}
+
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-converters
+ ${spring.cloud.contract.verifier.version}
+
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-stub-runner
+ ${spring.cloud.contract.verifier.version}
+
+
+
+ org.eclipse.aether
+ aether-api
+ ${aether.version}
+ provided
+
+
+
+ org.apache.maven.shared
+ maven-filtering
+ 3.1.0
+
+
+
+ ch.qos.logback
+ logback-core
+ 1.1.3
+
+
+ org.slf4j
+ slf4j-simple
+ 1.7.12
+ test
+
+
+
+ javax.inject
+ javax.inject
+ 1
+ provided
+
+
+ org.apache.maven
+ maven-core
+ ${maven.version}
+ provided
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ ${maven.version}
+ provided
+
+
+ org.apache.maven
+ maven-model
+
+
+ org.apache.maven
+ maven-artifact
+
+
+ org.eclipse.sisu
+ org.eclipse.sisu.plexus
+
+
+
+
+ org.apache.maven.plugin-tools
+ maven-plugin-annotations
+ ${maven.plugin.plugin.version}
+ provided
+
+
+
+ org.apache.maven
+ maven-archiver
+ 3.0.0
+
+
+ org.codehaus.plexus
+ plexus-archiver
+ 3.1
+
+
+
+ io.takari.maven.plugins
+ takari-plugin-testing
+ 2.9.0
+ test
+
+
+ io.takari.maven.plugins
+ takari-plugin-integration-testing
+ 2.9.0
+ pom
+ test
+
+
+ org.apache.maven
+ maven-compat
+ ${maven.version}
+ test
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ org.assertj
+ assertj-core
+ 2.4.0
+ test
+
+
+
+
+
+
+ release
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 1.6
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.0.0
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.3
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+
+
+
+ spring
+
+ true
+
+
+
+ spring-snapshots
+ Spring Snapshots
+ http://repo.spring.io/libs-snapshot-local
+
+ true
+
+
+
+ spring-milestones
+ Spring Milestones
+ http://repo.spring.io/libs-milestone-local
+
+ false
+
+
+
+ spring-releases
+ Spring Releases
+ http://repo.spring.io/release
+
+ false
+
+
+
+
+
+ spring-snapshots
+ Spring Snapshots
+ http://repo.spring.io/libs-snapshot-local
+
+ true
+
+
+
+ spring-milestones
+ Spring Milestones
+ http://repo.spring.io/libs-milestone-local
+
+ false
+
+
+
+ spring-plugin-snapshots
+ Spring Snapshots
+ http://repo.spring.io/plugins-snapshot-local
+
+ true
+
+
+
+ spring-plugin-milestones
+ Spring Milestones
+ http://repo.spring.io/plugins-milestone-local
+
+ false
+
+
+
+
+
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/etc/header.txt b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/etc/header.txt
new file mode 100644
index 0000000000..771f93dfec
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/etc/header.txt
@@ -0,0 +1,14 @@
+
+ Copyright 2013-${year} the original author or authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/CopyContracts.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/CopyContracts.groovy
new file mode 100644
index 0000000000..25f2014644
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/CopyContracts.groovy
@@ -0,0 +1,63 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.apache.maven.execution.MavenSession
+import org.apache.maven.model.Resource
+import org.apache.maven.plugin.MojoExecutionException
+import org.apache.maven.project.MavenProject
+import org.apache.maven.shared.filtering.MavenFilteringException
+import org.apache.maven.shared.filtering.MavenResourcesExecution
+import org.apache.maven.shared.filtering.MavenResourcesFiltering
+
+@CompileStatic
+@Slf4j
+class CopyContracts {
+
+ private final MavenProject project
+ private final MavenSession mavenSession
+ private final MavenResourcesFiltering mavenResourcesFiltering
+
+ CopyContracts(MavenProject project, MavenSession mavenSession, MavenResourcesFiltering mavenResourcesFiltering) {
+ this.project = project
+ this.mavenSession = mavenSession
+ this.mavenResourcesFiltering = mavenResourcesFiltering
+ }
+
+ void copy(File contractsDirectory, File outputDirectory) {
+ log.info('Copying Spring Cloud Contract Verifier contracts')
+ Resource testResource = new Resource(directory: contractsDirectory.absolutePath)
+ MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution(
+ resources: [testResource],
+ outputDirectory: new File(outputDirectory, 'contracts'),
+ mavenProject: project,
+ encoding: 'UTF-8',
+ mavenSession: mavenSession);
+ mavenResourcesExecution.injectProjectBuildFilters = false
+ mavenResourcesExecution.overwrite = true
+ mavenResourcesExecution.includeEmptyDirs = false
+ mavenResourcesExecution.filterFilenames = false
+ try {
+ mavenResourcesFiltering.filterResources(mavenResourcesExecution);
+ } catch (MavenFilteringException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/ManifestCreator.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/ManifestCreator.groovy
new file mode 100644
index 0000000000..e6dd688d85
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/ManifestCreator.groovy
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven
+
+import org.apache.maven.model.Plugin
+import org.apache.maven.project.MavenProject
+import org.codehaus.plexus.archiver.jar.Manifest
+
+class ManifestCreator {
+ static Manifest createManifest(MavenProject project) {
+ Manifest manifest = new Manifest();
+ Plugin verifierMavenPlugin = project.getBuildPlugins().find { it.artifactId == 'spring-cloud-contract-verifier-maven-plugin' }
+ manifest.addConfiguredAttribute(new Manifest.Attribute("Spring-Cloud-Contract-Verifier-Maven-Plugin-Version", verifierMavenPlugin.version));
+ if (verifierMavenPlugin.getDependencies()) {
+ String verifierVersion = verifierMavenPlugin.getDependencies().find {
+ it.artifactId == 'spring-cloud-contract-verifier-core'
+ }.version
+ manifest.addConfiguredAttribute(new Manifest.Attribute("Spring-Cloud-Contract-Verifier-Version", verifierVersion));
+ }
+ return manifest
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/stubrunner/AetherStubDownloaderFactory.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/stubrunner/AetherStubDownloaderFactory.groovy
new file mode 100644
index 0000000000..f6aa07e085
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/stubrunner/AetherStubDownloaderFactory.groovy
@@ -0,0 +1,49 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven.stubrunner
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.apache.maven.project.MavenProject
+import org.eclipse.aether.RepositorySystem
+import org.eclipse.aether.RepositorySystemSession
+import org.springframework.cloud.contract.stubrunner.AetherStubDownloader
+
+import javax.inject.Inject
+import javax.inject.Named
+import javax.inject.Singleton
+
+@Named
+@Singleton
+@CompileStatic
+@Slf4j
+class AetherStubDownloaderFactory {
+
+ private final MavenProject project
+ private final RepositorySystem repoSystem
+
+ @Inject
+ AetherStubDownloaderFactory(RepositorySystem repoSystem, MavenProject project) {
+ this.repoSystem = repoSystem
+ this.project = project
+ }
+
+ AetherStubDownloader build(RepositorySystemSession repoSession) {
+ return new AetherStubDownloader(repoSystem, project.remoteProjectRepositories, repoSession)
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/stubrunner/LocalStubRunner.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/stubrunner/LocalStubRunner.groovy
new file mode 100644
index 0000000000..687c3e1cd0
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/stubrunner/LocalStubRunner.groovy
@@ -0,0 +1,38 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven.stubrunner
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.springframework.cloud.contract.stubrunner.StubConfiguration
+import org.springframework.cloud.contract.stubrunner.StubRunner
+import org.springframework.cloud.contract.stubrunner.StubRunnerOptions
+
+import javax.inject.Named
+
+@Named
+@CompileStatic
+@Slf4j
+class LocalStubRunner {
+
+ StubRunner run(String contractsDir, StubRunnerOptions options) {
+ log.info("Launching StubRunner with contracts from ${contractsDir}")
+ StubRunner stubRunner = new StubRunner(options, contractsDir, new StubConfiguration(contractsDir))
+ stubRunner.runStubs()
+ return stubRunner
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/stubrunner/RemoteStubRunner.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/stubrunner/RemoteStubRunner.groovy
new file mode 100644
index 0000000000..f85e6f80a2
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/maven/stubrunner/RemoteStubRunner.groovy
@@ -0,0 +1,52 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven.stubrunner
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.eclipse.aether.RepositorySystemSession
+import org.springframework.cloud.contract.stubrunner.*
+
+import javax.inject.Inject
+import javax.inject.Named
+
+@Named
+@CompileStatic
+@Slf4j
+class RemoteStubRunner {
+
+ private final AetherStubDownloaderFactory aetherStubDownloaderFactory
+
+ @Inject
+ RemoteStubRunner(AetherStubDownloaderFactory aetherStubDownloaderFactory) {
+ this.aetherStubDownloaderFactory = aetherStubDownloaderFactory
+ }
+
+ BatchStubRunner run(StubRunnerOptions options, RepositorySystemSession repositorySystemSession) {
+ AetherStubDownloader stubDownloader = aetherStubDownloaderFactory.build(repositorySystemSession)
+ try {
+ log.debug("Launching StubRunner with args: $options")
+ BatchStubRunner stubRunner = new BatchStubRunnerFactory(options, stubDownloader).buildBatchStubRunner()
+ RunningStubs runningCollaborators = stubRunner.runStubs()
+ log.info(runningCollaborators.toString())
+ return stubRunner
+ } catch (Exception e) {
+ log.error("An exception occurred while trying to execute the stubs: ${e.message}")
+ throw e
+ }
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/ConvertMojo.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/ConvertMojo.java
new file mode 100644
index 0000000000..cd8c5063b1
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/ConvertMojo.java
@@ -0,0 +1,105 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven;
+
+import java.io.File;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.filtering.MavenResourcesFiltering;
+import org.springframework.cloud.contract.verifier.config.ContractVerifierConfigProperties;
+import org.springframework.cloud.contract.verifier.wiremock.DslToWireMockClientConverter;
+import org.springframework.cloud.contract.verifier.wiremock.RecursiveFilesConverter;
+
+/**
+ * Convert Spring Cloud Contract Verifier contracts into WireMock stubs mappings.
+ *
+ * This goal allow to generate `stubs-jar` or execute `spring-cloud-contract-verifier:run` with generated WireMock mappings.
+ */
+@Mojo(name = "convert", requiresProject = false, defaultPhase = LifecyclePhase.PROCESS_TEST_RESOURCES)
+public class ConvertMojo extends AbstractMojo {
+
+ /**
+ * Directory containing Spring Cloud Contract Verifier contracts written using the GroovyDSL
+ */
+ @Parameter(defaultValue = "${basedir}/src/test/resources/contracts")
+ private File contractsDirectory;
+
+ /**
+ * Directory where the generated WireMock stubs from Groovy DSL should be placed.
+ * You can then mention them in your packaging task to create jar with stubs
+ */
+ @Parameter(defaultValue = "${project.build.directory}/stubs")
+ private File outputDirectory;
+
+ /**
+ * Directory containing contracts written using the GroovyDSL
+ *
+ * This parameter is only used when goal is executed outside of maven project.
+ */
+ @Parameter(property = "contractsDirectory", defaultValue = "${basedir}")
+ private File source;
+
+ @Parameter(property = "stubsDirectory", defaultValue = "${basedir}")
+ private File destination;
+
+ @Parameter(property = "spring.cloud.contract.verifier.skip", defaultValue = "false")
+ private boolean skip;
+
+ @Parameter(defaultValue = "${session}", readonly = true)
+ private MavenSession mavenSession;
+
+ @Parameter(defaultValue = "${project}", readonly = true)
+ private MavenProject project;
+
+ @Component(role = MavenResourcesFiltering.class, hint = "default")
+ private MavenResourcesFiltering mavenResourcesFiltering;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+
+ if (skip) {
+ getLog().info(String.format("Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip=%s", skip));
+ return;
+ }
+
+ new CopyContracts(project, mavenSession, mavenResourcesFiltering).copy(contractsDirectory, outputDirectory);
+
+ final ContractVerifierConfigProperties config = new ContractVerifierConfigProperties();
+ config.setContractsDslDir(isInsideProject() ? contractsDirectory : source);
+ config.setStubsOutputDir(isInsideProject() ? new File(outputDirectory, "mappings") : destination);
+
+ getLog().info("Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings");
+ getLog().info(String.format(" Spring Cloud Contract Verifier contracts directory: %s", config.getContractsDslDir()));
+ getLog().info(String.format("WireMock stubs mappings directory: %s", config.getStubsOutputDir()));
+
+ RecursiveFilesConverter converter = new RecursiveFilesConverter(new DslToWireMockClientConverter(), config);
+ converter.processFiles();
+ }
+
+ private boolean isInsideProject() {
+ return mavenSession.getRequest().isProjectPresent();
+ }
+
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/GenerateStubsMojo.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/GenerateStubsMojo.java
new file mode 100644
index 0000000000..dfb657506a
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/GenerateStubsMojo.java
@@ -0,0 +1,100 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven;
+
+import java.io.File;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+
+@Mojo(name = "generateStubs", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true)
+public class GenerateStubsMojo extends AbstractMojo {
+
+ private static final String STUB_MAPPING_FILE_PATTERN = "**/*.json";
+ private static final String CONTRACT_FILE_PATTERN = "**/*.groovy";
+
+ @Parameter(defaultValue = "${project.build.directory}", readonly = true, required = true)
+ private File projectBuildDirectory;
+
+ @Parameter(property = "stubsDirectory", defaultValue = "${project.build.directory}/stubs")
+ private File outputDirectory;
+
+ /**
+ * Set this to "true" to bypass Verifier execution..
+ */
+ @Parameter(property = "spring.cloud.contract.verifier.skip", defaultValue = "false")
+ private boolean skip;
+
+ @Component
+ private MavenProjectHelper projectHelper;
+
+ @Parameter(defaultValue = "${project}", readonly = true)
+ private MavenProject project;
+
+ @Component(role = Archiver.class, hint = "jar")
+ private JarArchiver archiver;
+
+ @Parameter(defaultValue = "true")
+ private boolean attachContracts;
+
+ @Parameter(defaultValue = "stubs")
+ private String classifier;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ if (skip) {
+ getLog().info("Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip=" + skip);
+ return;
+ }
+ File stubsJarFile = createStubJar(outputDirectory);
+ projectHelper.attachArtifact(project, "jar", classifier, stubsJarFile);
+ }
+
+ private File createStubJar(File stubsOutputDir) throws MojoFailureException, MojoExecutionException {
+ if (!stubsOutputDir.exists()) {
+ throw new MojoExecutionException("Stubs could not be found: " + stubsOutputDir.getAbsolutePath() + ".\nPlease make sure that spring-cloud-contract-verifier:convert was invoked");
+ }
+ String stubArchiveName = project.getBuild().getFinalName() + "-" + classifier + ".jar";
+ File stubsJarFile = new File(projectBuildDirectory, stubArchiveName);
+ try {
+ if (attachContracts) {
+ archiver.addDirectory(stubsOutputDir, new String[]{STUB_MAPPING_FILE_PATTERN,
+ CONTRACT_FILE_PATTERN }, new String[0]);
+ } else {
+ getLog().info("Skipping attaching Spring Cloud Contract Verifier contracts");
+ archiver.addDirectory(stubsOutputDir, new String[]{STUB_MAPPING_FILE_PATTERN}, new String[]{
+ CONTRACT_FILE_PATTERN });
+ }
+ archiver.setCompress(true);
+ archiver.setDestFile(stubsJarFile);
+ archiver.addConfiguredManifest(ManifestCreator.createManifest(project));
+ archiver.createArchive();
+ } catch (Exception e) {
+ throw new MojoFailureException("Exception while packaging " + classifier + " jar.", e);
+ }
+ return stubsJarFile;
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/GenerateTestsMojo.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/GenerateTestsMojo.java
new file mode 100644
index 0000000000..ddd78f7c2d
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/GenerateTestsMojo.java
@@ -0,0 +1,142 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProject;
+import org.springframework.cloud.contract.spec.ContractVerifierException;
+import org.springframework.cloud.contract.verifier.TestGenerator;
+import org.springframework.cloud.contract.verifier.config.ContractVerifierConfigProperties;
+import org.springframework.cloud.contract.verifier.config.TestFramework;
+import org.springframework.cloud.contract.verifier.config.TestMode;
+
+@Mojo(name = "generateTests", defaultPhase = LifecyclePhase.GENERATE_TEST_SOURCES, requiresDependencyResolution = ResolutionScope.TEST)
+public class GenerateTestsMojo extends AbstractMojo {
+
+ @Parameter(property = "spring.cloud.contract.verifier.contractsDirectory", defaultValue = "${project.basedir}/src/test/resources/contracts")
+ private File contractsDirectory;
+
+ @Parameter(defaultValue = "${project.build.directory}/generated-test-sources/contracts")
+ private File generatedTestSourcesDir;
+
+ @Parameter(defaultValue = "org.springframework.cloud.contract.verifier.tests")
+ private String basePackageForTests;
+
+ @Parameter
+ private String baseClassForTests;
+
+ @Parameter(defaultValue = "MOCKMVC")
+ private TestMode testMode;
+
+ @Parameter(defaultValue = "JUNIT")
+ private TestFramework testFramework;
+
+ @Parameter
+ private String ruleClassForTests;
+
+ @Parameter
+ private String nameSuffixForTests;
+
+ /**
+ * Imports that should be added to generated tests
+ */
+ @Parameter
+ private String[] imports;
+
+ /**
+ * Static imports that should be added to generated tests
+ */
+ @Parameter
+ private String[] staticImports;
+
+ /**
+ * Patterns that should not be taken into account for processing
+ */
+ @Parameter
+ private List excludedFiles;
+
+ /**
+ * Patterns for which Spring Cloud Contract Verifier should generate @Ignored tests
+ */
+ @Parameter
+ private List ignoredFiles;
+
+ @Parameter(defaultValue = "${project}", readonly = true)
+ private MavenProject project;
+
+ @Parameter(property = "spring.cloud.contract.verifier.skip", defaultValue = "false")
+ private boolean skip;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ if (skip) {
+ getLog().info("Skipping Spring Cloud Contract Verifier execution: spring.cloud.contract.verifier.skip=" + skip);
+ return;
+ }
+ getLog().info("Generating server tests source code for Spring Cloud Contract Verifier contract verification");
+ final ContractVerifierConfigProperties config = new ContractVerifierConfigProperties();
+ config.setContractsDslDir(contractsDirectory);
+ config.setGeneratedTestSourcesDir(generatedTestSourcesDir);
+ config.setTargetFramework(testFramework);
+ config.setTestMode(testMode);
+ config.setBasePackageForTests(basePackageForTests);
+ config.setBaseClassForTests(baseClassForTests);
+ config.setRuleClassForTests(ruleClassForTests);
+ config.setNameSuffixForTests(nameSuffixForTests);
+ config.setImports(imports);
+ config.setStaticImports(staticImports);
+ config.setIgnoredFiles(ignoredFiles);
+ config.setExcludedFiles(excludedFiles);
+ project.addTestCompileSourceRoot(generatedTestSourcesDir.getAbsolutePath());
+ if (getLog().isInfoEnabled()) {
+ getLog().info("Test Source directory: " + generatedTestSourcesDir.getAbsolutePath() + " added.");
+ getLog().info("Using " + config.getBaseClassForTests() + " as base class for test classes");
+ }
+ try {
+ TestGenerator generator = new TestGenerator(config);
+ int generatedClasses = generator.generate();
+ getLog().info("Generated " + generatedClasses + " test classes.");
+ } catch (ContractVerifierException e) {
+ throw new MojoExecutionException(String.format("Spring Cloud Contract Verifier Plugin exception: %s", e.getMessage()), e);
+ }
+ }
+
+ public List getExcludedFiles() {
+ return excludedFiles;
+ }
+
+ public void setExcludedFiles(List excludedFiles) {
+ this.excludedFiles = excludedFiles;
+ }
+
+ public List getIgnoredFiles() {
+ return ignoredFiles;
+ }
+
+ public void setIgnoredFiles(List ignoredFiles) {
+ this.ignoredFiles = ignoredFiles;
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/RunMojo.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/RunMojo.java
new file mode 100644
index 0000000000..c8b4b42f0f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/java/org/springframework/cloud/contract/verifier/maven/RunMojo.java
@@ -0,0 +1,151 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.eclipse.aether.RepositorySystemSession;
+import org.springframework.cloud.contract.stubrunner.BatchStubRunner;
+import org.springframework.cloud.contract.stubrunner.StubRunner;
+import org.springframework.cloud.contract.stubrunner.StubRunnerOptions;
+import org.springframework.cloud.contract.stubrunner.StubRunnerOptionsBuilder;
+import org.springframework.cloud.contract.verifier.maven.stubrunner.LocalStubRunner;
+
+import org.springframework.cloud.contract.verifier.maven.stubrunner.RemoteStubRunner;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+
+@Mojo(name = "run", requiresProject = false, requiresDependencyResolution = ResolutionScope.RUNTIME)
+public class RunMojo extends AbstractMojo {
+
+ @Parameter(defaultValue = "${repositorySystemSession}", readonly = true)
+ private RepositorySystemSession repoSession;
+
+ @Parameter(defaultValue = "${project.build.directory}/contracts/mappings")
+ private File stubsDirectory;
+
+ @Parameter(property = "stubsDirectory", defaultValue = "${basedir}")
+ private File destination;
+
+ /**
+ * HTTP port for WireMock server
+ */
+ @Parameter(property = "spring.cloud.contract.verifier.http.port", defaultValue = "8080")
+ private int httpPort;
+
+ /**
+ * Set this to "true" to bypass verifier execution.
+ */
+ @Parameter(property = "spring.cloud.contract.verifier.skip", defaultValue = "false")
+ private boolean skip;
+
+ /**
+ * Set this to "true" to bypass verifier test generation.
+ */
+ @Parameter(property = "spring.cloud.contract.verifier.skipTestOnly", defaultValue = "false")
+ private boolean skipTestOnly;
+
+ @Parameter(property = "spring.cloud.contract.verifier.stubs")
+ private String stubs;
+
+ @Parameter(property = "spring.cloud.contract.verifier.http.minPort", defaultValue = "10000")
+ private int minPort;
+
+ @Parameter(property = "spring.cloud.contract.verifier.http.maxPort", defaultValue = "15000")
+ private int maxPort;
+
+ /**
+ * Classifier used by stubs artifacts.
+ */
+ @Parameter(defaultValue = "stubs")
+ private String stubsClassifier = "stubs";
+
+ @Parameter(defaultValue = "${session}", readonly = true)
+ private MavenSession mavenSession;
+
+ private final LocalStubRunner localStubRunner;
+
+ private final RemoteStubRunner remoteStubRunner;
+
+ @Inject
+ public RunMojo(LocalStubRunner localStubRunner, RemoteStubRunner remoteStubRunner) {
+ this.localStubRunner = localStubRunner;
+ this.remoteStubRunner = remoteStubRunner;
+ }
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ if (skip || skipTestOnly) {
+ getLog().info("Skipping verifier execution: spring.cloud.contract.verifier.skip=" + String.valueOf(skip));
+ return;
+ }
+ BatchStubRunner batchStubRunner = null;
+ StubRunnerOptionsBuilder optionsBuilder = new StubRunnerOptionsBuilder()
+ .withStubsClassifier(stubsClassifier);
+ if (isNullOrEmpty(stubs)) {
+ StubRunnerOptions options = optionsBuilder
+ .withPort(httpPort)
+ .build();
+ StubRunner stubRunner = localStubRunner.run(resolveStubsDirectory().getAbsolutePath(), options);
+ batchStubRunner = new BatchStubRunner(Collections.singleton(stubRunner));
+ } else {
+ StubRunnerOptions options = optionsBuilder
+ .withStubs(stubs)
+ .withMinMaxPort(minPort, maxPort)
+ .build();
+ batchStubRunner = remoteStubRunner.run(options, repoSession);
+ }
+ pressAnyKeyToContinue();
+ if (batchStubRunner != null) {
+ try {
+ batchStubRunner.close();
+ } catch (IOException e) {
+ throw new MojoExecutionException("Fail to close batch stub runner", e);
+ }
+ }
+ }
+
+ private File resolveStubsDirectory() {
+ if (isInsideProject()) {
+ return stubsDirectory;
+ } else {
+ return destination;
+ }
+ }
+
+ private void pressAnyKeyToContinue() {
+ getLog().info("Press ENTER to continue...");
+ try {
+ System.in.read();
+ } catch (Exception ignored) {
+ }
+ }
+
+ private boolean isInsideProject() {
+ return mavenSession.getRequest().isProjectPresent();
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/resources/META-INF/plexus/components.xml
new file mode 100644
index 0000000000..19a83714fc
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/main/resources/META-INF/plexus/components.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+ org.apache.maven.lifecycle.Lifecycle
+ org.apache.maven.lifecycle.Lifecycle
+ spring-cloud-contract-verifier
+
+ spring-cloud-contract-verifier
+
+ spring-cloud-contract-verifier-not-used-phase
+
+
+
+ org.springframework.cloud.contract:spring-cloud-contract-verifier-maven-plugin:${project.version}:convert
+
+
+ org.springframework.cloud.contract:spring-cloud-contract-verifier-maven-plugin:${project.version}:generateTests
+
+
+ org.springframework.cloud.contract:spring-cloud-contract-verifier-maven-plugin:${project.version}:generateStubs
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/complex-content.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/complex-content.adoc
new file mode 100644
index 0000000000..fad117ee37
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/complex-content.adoc
@@ -0,0 +1,38 @@
+== More Complex Plugin Configuration
+
+Sample more complex configuration for Java Project with JUnit tests.
+
+
+=== Project configuration for Accurest with JUnit tests and stub publishing
+
+[source,xml]
+----
+include::{root_folder}/src/test/projects/complex-configuration/pom.xml[tags=plugin]
+----
+
+=== Base Test class
+
+[source,java]
+----
+include::{root_folder}/src/test/projects/complex-configuration/src/test/java/com/blogspot/toomuchcoding/frauddetection/BaseAccurest.java[]
+----
+
+
+=== Sample additional matcher
+
+[source,java]
+----
+include::{root_folder}/src/test/projects/complex-configuration/src/test/java/com/blogspot/toomuchcoding/frauddetection/matchers/CustomMatchers.java[]
+----
+
+=== Sample contract using matcher
+
+[source,java]
+----
+include::{root_folder}/src/test/projects/complex-configuration/src/test/contracts/shouldMarkClientAsNotFraud.groovy[]
+----
+
+
+=== Project source code
+
+https://github.com/Codearte/accurest-maven-plugin/tree/master/src/test/projects/complex-configuration
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/complex.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/complex.adoc
new file mode 100644
index 0000000000..e29ea2b549
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/complex.adoc
@@ -0,0 +1,3 @@
+:root_folder: ../../..
+
+include::complex.adoc[]
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/index.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/index.adoc
new file mode 100644
index 0000000000..f73fbb3dc9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/index.adoc
@@ -0,0 +1,10 @@
+= Spring Cloud Contract Verifier Maven Plugin
+
+Just to make long story short - Spring Cloud Contract Verifier is a tool that enables Consumer Driven Contract (CDC) development of JVM-based applications.
+
+ * Stubs mappings to be used by WireMock when doing integration testing on the client code (client tests).
+
+ * Acceptance tests used to verify if server-side implementation of the API is compliant with the contract (server tests).
+
+Spring Cloud Contract Verifier moves TDD to the level of software architecture.
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/junit.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/junit.adoc
new file mode 100644
index 0000000000..ad56a34c79
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/junit.adoc
@@ -0,0 +1,29 @@
+== Java Project with JUnit Tests
+
+Sample minimal configuration for Java Project with JUnit tests.
+
+=== Test dependencies for generated contract verification tests
+
+[source,xml]
+----
+include::../../../src/test/projects/spring-boot-java/pom.xml[tags=dependencies]
+----
+
+=== Project configuration for Accurest with JUnit tests and stub publishing
+
+[source,xml]
+----
+include::../../../src/test/projects/spring-boot-java/pom.xml[tags=plugin]
+----
+
+=== Base Test class
+
+[source,java]
+----
+include::../../../src/test/projects/spring-boot-java/src/test/java/hello/BaseAccurest.java[]
+----
+
+
+=== Project source code
+
+https://github.com/Codearte/accurest-maven-plugin/tree/master/src/test/projects/spring-boot-java
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/spock.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/spock.adoc
new file mode 100644
index 0000000000..6e262ede51
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/spock.adoc
@@ -0,0 +1,29 @@
+== Groovy Project with Spock Specifications
+
+Sample minimal configuration for Groovy Project with Spock Specification
+
+=== Test dependencies for generated contract verification tests
+
+[source,xml]
+----
+include::../../../src/test/projects/spring-boot-groovy/pom.xml[tags=dependencies]
+----
+
+=== Project configuration for Accurest, Groovy, Spock specifications and stub publishing
+
+
+[source,xml]
+----
+include::../../../src/test/projects/spring-boot-groovy/pom.xml[tags=plugin]
+----
+
+=== Base Specification class
+
+[source,java]
+----
+include::../../../src/test/projects/spring-boot-groovy/src/test/groovy/hello/BaseAccurest.groovy[]
+----
+
+=== Project source code
+
+https://github.com/Codearte/accurest-maven-plugin/tree/master/src/test/projects/spring-boot-groovy
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/usage.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/usage.adoc
new file mode 100644
index 0000000000..825f738e45
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/asciidoc/usage.adoc
@@ -0,0 +1,35 @@
+= Usage
+
+== Converting Accurest GroovyDSL into WireMock stub mappings
+
+ mvn org.springframework.cloud.contract:spring-cloud-contract-verifier-maven-plugin:convert
+
+or shortly footnoteref:[prefix,Additional configuration inside `~/.m2/settings.xml` is required: `io.codearte.accurest`.]
+
+ mvn spring-cloud-contract-verifier:convert
+
+For more information please go to the Accurest Wiki or Plugin Documentation Site.
+
+== Accurest Stub Runner
+
+Run stubs mappings from current directory:
+
+ mvn org.springframework.cloud.contract:spring-cloud-contract-verifier-maven-plugin:run
+
+or shortly footnoteref:[prefix]
+
+ mvn spring-cloud-contract-verifier:run
+
+== Running stubs from repository
+
+ mvn spring-cloud-contract-verifier:run -Dstubs="org.springframework:gs-rest-service"
+
+where `org.springframework:gs-rest-service` is artifact with stubs classifier contains wiremock mappings.
+
+== Project configuration
+
+[source,xml]
+----
+include::../../../src/test/projects/spring-boot-java/pom.xml[tags=plugin]
+----
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/site.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/site.xml
new file mode 100644
index 0000000000..8d23c5f4d2
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/site/site.xml
@@ -0,0 +1,58 @@
+
+
+
+ ${project.name}
+
+
+
+
+
+ org.apache.maven.skins
+ maven-fluido-skin
+ 1.5
+
+
+
+ true
+ true
+
+ codearte/accurest-maven-plugin
+ right
+ orange
+
+ »
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/java/org/springframework/cloud/contract/verifier/maven/PluginIT.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/java/org/springframework/cloud/contract/verifier/maven/PluginIT.java
new file mode 100644
index 0000000000..cc2c878333
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/java/org/springframework/cloud/contract/verifier/maven/PluginIT.java
@@ -0,0 +1,113 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven;
+
+import java.io.File;
+
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import io.takari.maven.testing.TestProperties;
+import io.takari.maven.testing.TestResources;
+import io.takari.maven.testing.executor.MavenRuntime;
+import io.takari.maven.testing.executor.MavenVersions;
+import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
+
+@RunWith(MavenJUnitTestRunner.class)
+@MavenVersions({ "3.3.3" })
+public class PluginIT {
+
+ @Rule
+ public final TestResources resources = new TestResources();
+
+ private final TestProperties properties = new TestProperties();
+
+ private final MavenRuntime maven;
+
+ public PluginIT(MavenRuntime.MavenRuntimeBuilder mavenBuilder) throws Exception {
+ this.maven = mavenBuilder.withCliOptions("-B", "-U").build();
+ }
+
+ @Test
+ public void should_build_project_Spring_Boot_Groovy_with_Accurest() throws Exception {
+ File basedir = resources.getBasedir("spring-boot-groovy");
+ maven.forProject(basedir)
+ .execute("package")
+ .assertErrorFreeLog()
+ .assertLogText("Generating server tests source code for Spring Cloud Contract Verifier contract verification")
+ .assertLogText("Generated 1 test classes.")
+ .assertLogText("Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings")
+ .assertLogText("Creating new json")
+ .assertLogText("Running org.springframework.cloud.contract.verifier.tests.ContractVerifierSpec")
+ .assertErrorFreeLog();
+ }
+
+ @Test
+ public void should_build_project_Spring_Boot_Java_with_Accurest() throws Exception {
+ File basedir = resources.getBasedir("spring-boot-java");
+ maven.forProject(basedir)
+ .execute("package")
+ .assertErrorFreeLog()
+ .assertLogText("Generating server tests source code for Spring Cloud Contract Verifier contract verification")
+ .assertLogText("Generated 1 test classes.")
+ .assertLogText("Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings")
+ .assertLogText("Creating new json")
+ .assertLogText("Running org.springframework.cloud.contract.verifier.tests.ContractVerifierTest")
+ .assertErrorFreeLog();
+ }
+
+ @Test
+ public void should_build_project_with_plugin_extension() throws Exception {
+ File basedir = resources.getBasedir("plugin-extension");
+ maven.forProject(basedir)
+ .execute("package")
+ .assertErrorFreeLog()
+ .assertLogText("Generating server tests source code for Spring Cloud Contract Verifier contract verification")
+ .assertLogText("Generated 1 test classes.")
+ .assertLogText("Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings")
+ .assertLogText("Creating new json")
+ .assertLogText("Running org.springframework.cloud.contract.verifier.tests.ContractVerifierTest")
+ .assertErrorFreeLog();
+ }
+
+ @Test
+ @Ignore("Ignored, because of bug accurest#245")
+ public void should_build_project_project_with_complex_configuration() throws Exception {
+ File basedir = resources.getBasedir("complex-configuration");
+ maven.forProject(basedir)
+ .execute("package")
+ .assertErrorFreeLog()
+ .assertLogText("Tests run: 2, Failures: 0, Errors: 0, Skipped: 1")
+ .assertLogText("Running com.blogspot.toomuchcoding.frauddetection.ContractVerifierTest")
+ .assertErrorFreeLog();
+ }
+
+ @Test
+ public void should_convert_Accurest_Contracts_to_WireMock_Stubs_mappings() throws Exception {
+ File basedir = resources.getBasedir("pomless");
+ properties.getPluginVersion();
+ maven.forProject(basedir)
+ .withCliOption("-X")
+ .execute(String.format("org.springframework.cloud.contract:spring-cloud-contract-verifier-maven-plugin:%s:convert",
+ properties.getPluginVersion()))
+ .assertLogText("Converting from Spring Cloud Contract Verifier contracts to WireMock stubs mappings")
+ .assertLogText("Creating new json")
+ .assertErrorFreeLog();
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/java/org/springframework/cloud/contract/verifier/maven/PluginUnitTest.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/java/org/springframework/cloud/contract/verifier/maven/PluginUnitTest.java
new file mode 100644
index 0000000000..5484243411
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/java/org/springframework/cloud/contract/verifier/maven/PluginUnitTest.java
@@ -0,0 +1,115 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.contract.verifier.maven;
+
+import java.io.File;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import io.takari.maven.testing.TestMavenRuntime;
+import io.takari.maven.testing.TestResources;
+
+import static io.takari.maven.testing.TestMavenRuntime.newParameter;
+import static io.takari.maven.testing.TestResources.assertFilesNotPresent;
+import static io.takari.maven.testing.TestResources.assertFilesPresent;
+
+public class PluginUnitTest {
+
+ @Rule
+ public final TestResources resources = new TestResources();
+
+ @Rule
+ public final TestMavenRuntime maven = new TestMavenRuntime();
+
+ @Test
+ public void shouldGenerateWireMockStubsInDefaultLocation() throws Exception {
+ File basedir = resources.getBasedir("basic");
+ maven.executeMojo(basedir, "convert");
+ assertFilesPresent(basedir, "target/stubs/mappings/Sample.json");
+ assertFilesNotPresent(basedir, "target/stubs/mappings/Messaging.json");
+ }
+
+ @Test
+ public void shouldGenerateWireMockFromStubsDirectory() throws Exception {
+ File basedir = resources.getBasedir("withStubs");
+ maven.executeMojo(basedir, "convert", newParameter("contractsDirectory", "src/test/resources/stubs"));
+ assertFilesPresent(basedir, "target/stubs/mappings/Sample.json");
+ }
+
+ @Test
+ public void shouldCopyContracts() throws Exception {
+ File basedir = resources.getBasedir("basic");
+ maven.executeMojo(basedir, "convert");
+ assertFilesPresent(basedir, "target/stubs/contracts/Sample.groovy");
+ assertFilesPresent(basedir, "target/stubs/contracts/Messaging.groovy");
+ }
+ @Test
+ public void shouldGenerateWireMockStubsInSelectedLocation() throws Exception {
+ File basedir = resources.getBasedir("basic");
+ maven.executeMojo(basedir, "convert", newParameter("outputDirectory", "target/foo"));
+ assertFilesPresent(basedir, "target/foo/mappings/Sample.json");
+ }
+
+ @Test
+ public void shouldGenerateContractSpecificationInDefaultLocation() throws Exception {
+ File basedir = resources.getBasedir("basic");
+ maven.executeMojo(basedir, "generateTests", newParameter("testFramework", "SPOCK"));
+ assertFilesPresent(basedir,
+ "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierSpec.groovy");
+ }
+
+ @Test
+ public void shouldGenerateContractTestsInDefaultLocation() throws Exception {
+ File basedir = resources.getBasedir("basic");
+ maven.executeMojo(basedir, "generateTests");
+ assertFilesPresent(basedir,
+ "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
+ }
+
+ @Test
+ public void shouldGenerateContractTestsWithCustomImports() throws Exception {
+ File basedir = resources.getBasedir("basic");
+ maven.executeMojo(basedir, "generateTests", newParameter("imports", ""));
+ assertFilesPresent(basedir,
+ "target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java");
+ }
+
+ @Test
+ public void shouldGenerateStubs() throws Exception {
+ File basedir = resources.getBasedir("generatedStubs");
+ maven.executeMojo(basedir, "generateStubs");
+ assertFilesPresent(basedir, "target/sample-project-0.1-stubs.jar");
+ }
+
+ @Test
+ public void shouldGenerateStubsWithMappingsOnly() throws Exception {
+ File basedir = resources.getBasedir("generatedStubs");
+ maven.executeMojo(basedir, "generateStubs", newParameter("attachContracts", "false"));
+ assertFilesPresent(basedir, "target/sample-project-0.1-stubs.jar");
+ // FIXME: add assertion for jar content
+ }
+
+ @Test
+ public void shouldGenerateStubsWithCustomClassifier() throws Exception {
+ File basedir = resources.getBasedir("generatedStubs");
+ maven.executeMojo(basedir, "generateStubs", newParameter("classifier", "foo"));
+ assertFilesPresent(basedir, "target/sample-project-0.1-foo.jar");
+ }
+
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/basic/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/basic/pom.xml
new file mode 100644
index 0000000000..e7ee761ca9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/basic/pom.xml
@@ -0,0 +1,37 @@
+
+
+
+ 4.0.0
+
+ io.codearte.accurest.sample
+ sample-project
+ 0.1
+
+
+
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-maven-plugin
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/basic/src/test/resources/contracts/Messaging.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/basic/src/test/resources/contracts/Messaging.groovy
new file mode 100644
index 0000000000..b21f448049
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/basic/src/test/resources/contracts/Messaging.groovy
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ label 'some_label'
+ input {
+ messageFrom('jms:input')
+ messageBody([
+ bookName: 'foo'
+ ])
+ messageHeaders {
+ header('sample', 'header')
+ }
+ }
+ outputMessage {
+ sentTo('jms:output')
+ body([
+ bookName: 'foo'
+ ])
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/basic/src/test/resources/contracts/Sample.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/basic/src/test/resources/contracts/Sample.groovy
new file mode 100644
index 0000000000..094820225b
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/basic/src/test/resources/contracts/Sample.groovy
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ request {
+ method 'POST'
+ url('/users') {
+
+ }
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ body '''{ "login" : "john", "name": "John The Contract" }'''
+ }
+ response {
+ status 200
+ headers {
+ header 'Location': '/users/john'
+ }
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/.gitignore b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/.gitignore
new file mode 100644
index 0000000000..1de565933b
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/.gitignore
@@ -0,0 +1 @@
+target
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/pom.xml
new file mode 100644
index 0000000000..efebefaf10
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/pom.xml
@@ -0,0 +1,131 @@
+
+
+
+ 4.0.0
+
+ com.blogspot.toomuchcoding.frauddetection
+ frauddetection
+ 0.1.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.5.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ ch.qos.logback
+ logback-classic
+
+
+
+
+
+ com.jayway.restassured
+ rest-assured
+ 2.9.0
+ test
+
+
+ com.jayway.restassured
+ spring-mock-mvc
+ 2.9.0
+ test
+
+
+ com.toomuchcoding.jsonassert
+ jsonassert
+ 0.4.7
+ test
+
+
+ org.assertj
+ assertj-core
+ 2.4.0
+ test
+
+
+
+
+
+ 1.8
+ ${it-plugin.version}
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-maven-plugin
+ ${accurest-plugin.version}
+
+
+
+ convert
+ generateStubs
+ generateTests
+
+
+ src/test/accurest
+ com.blogspot.toomuchcoding.frauddetection
+ MOCKMVC
+ JUNIT
+ stubs
+ Test
+ org.junit.rules.ErrorCollector
+
+ com.blogspot.toomuchcoding.frauddetection.matchers.CustomMatchers.*
+
+
+ com.blogspot.toomuchcoding.frauddetection.matchers.CustomMatchers
+
+
+ broken**
+
+
+ shouldMarkClientAsFraud.groovy
+
+
+
+
+
+ com.blogspot.toomuchcoding.frauddetection.BaseAccurest
+
+
+
+
+
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/Application.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/Application.java
new file mode 100644
index 0000000000..bedd785957
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/Application.java
@@ -0,0 +1,28 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.blogspot.toomuchcoding.frauddetection;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/FraudDetectionController.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/FraudDetectionController.java
new file mode 100644
index 0000000000..ce53beb419
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/FraudDetectionController.java
@@ -0,0 +1,56 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.blogspot.toomuchcoding.frauddetection;
+
+import java.math.BigDecimal;
+
+import com.blogspot.toomuchcoding.frauddetection.model.FraudCheck;
+import com.blogspot.toomuchcoding.frauddetection.model.FraudCheckResult;
+
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import static com.blogspot.toomuchcoding.frauddetection.model.FraudCheckStatus.FRAUD;
+import static com.blogspot.toomuchcoding.frauddetection.model.FraudCheckStatus.OK;
+import static org.springframework.web.bind.annotation.RequestMethod.PUT;
+
+@RestController
+public class FraudDetectionController {
+
+ private static final String FRAUD_SERVICE_JSON_VERSION_1 = "application/vnd.fraud.v1+json";
+ private static final String NO_REASON = null;
+ private static final String AMOUNT_TOO_HIGH = "Amount too high";
+ private static final BigDecimal MAX_AMOUNT = new BigDecimal("5000");
+
+ @RequestMapping(
+ value = "/fraudcheck",
+ method = PUT,
+ consumes = FRAUD_SERVICE_JSON_VERSION_1,
+ produces = FRAUD_SERVICE_JSON_VERSION_1)
+ public FraudCheckResult fraudCheck(@RequestBody FraudCheck fraudCheck) {
+ if (amountGreaterThanThreshold(fraudCheck)) {
+ return new FraudCheckResult(FRAUD, AMOUNT_TOO_HIGH);
+ }
+ return new FraudCheckResult(OK, NO_REASON);
+ }
+
+ private boolean amountGreaterThanThreshold(FraudCheck fraudCheck) {
+ return MAX_AMOUNT.compareTo(fraudCheck.getLoanAmount()) < 0;
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/model/FraudCheck.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/model/FraudCheck.java
new file mode 100644
index 0000000000..67f51b8a39
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/model/FraudCheck.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.blogspot.toomuchcoding.frauddetection.model;
+
+import java.math.BigDecimal;
+
+public class FraudCheck {
+
+ private String clientPesel;
+
+ private BigDecimal loanAmount;
+
+ public FraudCheck() {
+ }
+
+ public String getClientPesel() {
+ return clientPesel;
+ }
+
+ public void setClientPesel(String clientPesel) {
+ this.clientPesel = clientPesel;
+ }
+
+ public BigDecimal getLoanAmount() {
+ return loanAmount;
+ }
+
+ public void setLoanAmount(BigDecimal loanAmount) {
+ this.loanAmount = loanAmount;
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/model/FraudCheckResult.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/model/FraudCheckResult.java
new file mode 100644
index 0000000000..a5fba329aa
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/model/FraudCheckResult.java
@@ -0,0 +1,48 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.blogspot.toomuchcoding.frauddetection.model;
+
+public class FraudCheckResult {
+
+ private FraudCheckStatus fraudCheckStatus;
+
+ private String rejectionReason;
+
+ public FraudCheckResult() {
+ }
+
+ public FraudCheckResult(FraudCheckStatus fraudCheckStatus, String rejectionReason) {
+ this.fraudCheckStatus = fraudCheckStatus;
+ this.rejectionReason = rejectionReason;
+ }
+
+ public FraudCheckStatus getFraudCheckStatus() {
+ return fraudCheckStatus;
+ }
+
+ public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) {
+ this.fraudCheckStatus = fraudCheckStatus;
+ }
+
+ public String getRejectionReason() {
+ return rejectionReason;
+ }
+
+ public void setRejectionReason(String rejectionReason) {
+ this.rejectionReason = rejectionReason;
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/model/FraudCheckStatus.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/model/FraudCheckStatus.java
new file mode 100644
index 0000000000..8ea884adb3
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/main/java/com/blogspot/toomuchcoding/frauddetection/model/FraudCheckStatus.java
@@ -0,0 +1,21 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.blogspot.toomuchcoding.frauddetection.model;
+
+public enum FraudCheckStatus {
+ OK, FRAUD
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/contracts/brokenContract.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/contracts/brokenContract.groovy
new file mode 100644
index 0000000000..48435cb1a2
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/contracts/brokenContract.groovy
@@ -0,0 +1,44 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ request {
+ method 'PUT'
+ url '/fraudcheck'
+ body("""
+ {
+ "clientPesel":"${value(client(regex('[0-9]{10}')), server('1234567890'))}",
+ "loanAmount":123.123
+ }
+ """
+ )
+ headers {
+ header('Content-Type', 'application/vnd.fraud.v1+json')
+ }
+
+ }
+ response {
+ status 999
+ body(
+ fraudCheckStatus: "OK",
+ rejectionReason: $(client(null), server(execute('assertThatRejectionReasonIsNull($it)')))
+ )
+ headers {
+ header('Content-Type': 'application/vnd.fraud.v1+json')
+ }
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/contracts/shouldMarkClientAsFraud.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/contracts/shouldMarkClientAsFraud.groovy
new file mode 100644
index 0000000000..9cd6dec8b1
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/contracts/shouldMarkClientAsFraud.groovy
@@ -0,0 +1,43 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ request {
+ method """PUT"""
+ url """/fraudcheck"""
+ body("""
+ {
+ "clientPesel":"${value(client(regex('[0-9]{10}')), server('1234567890'))}",
+ "loanAmount":99999}
+ """
+ )
+ headers {
+ header("""Content-Type""", """application/vnd.fraud.v1+json""")
+ }
+
+ }
+ response {
+ status 200
+ body( """{
+ "fraudCheckStatus": "${value(client('FRAUD'), server(regex('[A-Z]{5}')))}",
+ "rejectionReason": "Amount too high"
+}""")
+ headers {
+ header('Content-Type': 'application/vnd.fraud.v1+json')
+ }
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/contracts/shouldMarkClientAsNotFraud.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/contracts/shouldMarkClientAsNotFraud.groovy
new file mode 100644
index 0000000000..92b2646567
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/contracts/shouldMarkClientAsNotFraud.groovy
@@ -0,0 +1,44 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ request {
+ method 'PUT'
+ url '/fraudcheck'
+ body("""
+ {
+ "clientPesel":"${value(client(regex('[0-9]{10}')), server('1234567890'))}",
+ "loanAmount":123.123
+ }
+ """
+ )
+ headers {
+ header('Content-Type', 'application/vnd.fraud.v1+json')
+ }
+
+ }
+ response {
+ status 200
+ body(
+ fraudCheckStatus: "OK",
+ rejectionReason: $(client(null), server(execute('assertThatRejectionReasonIsNull($it)')))
+ )
+ headers {
+ header('Content-Type': 'application/vnd.fraud.v1+json')
+ }
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/java/com/blogspot/toomuchcoding/frauddetection/BaseAccurest.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/java/com/blogspot/toomuchcoding/frauddetection/BaseAccurest.java
new file mode 100644
index 0000000000..0bc555db19
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/java/com/blogspot/toomuchcoding/frauddetection/BaseAccurest.java
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.blogspot.toomuchcoding.frauddetection;
+
+import com.jayway.restassured.module.mockmvc.RestAssuredMockMvc;
+
+import org.junit.Before;
+
+public class BaseAccurest {
+
+ @Before
+ public void setup() {
+ RestAssuredMockMvc.standaloneSetup(new FraudDetectionController());
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/java/com/blogspot/toomuchcoding/frauddetection/matchers/CustomMatchers.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/java/com/blogspot/toomuchcoding/frauddetection/matchers/CustomMatchers.java
new file mode 100644
index 0000000000..44d5331c9e
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/src/test/java/com/blogspot/toomuchcoding/frauddetection/matchers/CustomMatchers.java
@@ -0,0 +1,27 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.blogspot.toomuchcoding.frauddetection.matchers;
+
+import org.junit.Assert;
+
+public class CustomMatchers {
+
+ public static void assertThatRejectionReasonIsNull(String rejectionReason) {
+ Assert.assertNull(rejectionReason);
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/generatedStubs/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/generatedStubs/pom.xml
new file mode 100644
index 0000000000..e7ee761ca9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/generatedStubs/pom.xml
@@ -0,0 +1,37 @@
+
+
+
+ 4.0.0
+
+ io.codearte.accurest.sample
+ sample-project
+ 0.1
+
+
+
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-maven-plugin
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/pom.xml
new file mode 100644
index 0000000000..7d5f62d156
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/pom.xml
@@ -0,0 +1,102 @@
+
+
+
+ 4.0.0
+
+ org.springframework
+ gs-rest-service
+ 0.1.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.5.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ ch.qos.logback
+ logback-classic
+
+
+
+
+
+ com.jayway.restassured
+ rest-assured
+ 2.9.0
+ test
+
+
+ com.jayway.restassured
+ spring-mock-mvc
+ 2.9.0
+ test
+
+
+ com.toomuchcoding.jsonassert
+ jsonassert
+ 0.4.7
+ test
+
+
+ org.assertj
+ assertj-core
+ 2.4.1
+ test
+
+
+
+
+
+ 1.8
+ ${it-plugin.version}
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-maven-plugin
+ ${accurest-plugin.version}
+ true
+
+ hello.BaseAccurest
+
+
+
+
+
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/main/java/hello/Application.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/main/java/hello/Application.java
new file mode 100644
index 0000000000..bb79fe49da
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/main/java/hello/Application.java
@@ -0,0 +1,28 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/main/java/hello/Greeting.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/main/java/hello/Greeting.java
new file mode 100644
index 0000000000..f22f746a8f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/main/java/hello/Greeting.java
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+public class Greeting {
+
+ private final long id;
+ private final String content;
+
+ public Greeting(long id, String content) {
+ this.id = id;
+ this.content = content;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getContent() {
+ return content;
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/main/java/hello/GreetingController.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/main/java/hello/GreetingController.java
new file mode 100644
index 0000000000..f6db9e06b9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/main/java/hello/GreetingController.java
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class GreetingController {
+
+ private static final String template = "Hello, %s!";
+ private final AtomicLong counter = new AtomicLong();
+
+ @RequestMapping("/greeting")
+ public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
+ return new Greeting(counter.incrementAndGet(),
+ String.format(template, name));
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/test/java/hello/BaseAccurest.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/test/java/hello/BaseAccurest.java
new file mode 100644
index 0000000000..5d04fddb2f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/test/java/hello/BaseAccurest.java
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+import com.jayway.restassured.module.mockmvc.RestAssuredMockMvc;
+
+import org.junit.Before;
+
+public class BaseAccurest {
+
+ @Before
+ public void setup() {
+ RestAssuredMockMvc.standaloneSetup(new GreetingController());
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/test/resources/contracts/greetings_ok.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/test/resources/contracts/greetings_ok.groovy
new file mode 100644
index 0000000000..4a5d9a792f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/test/resources/contracts/greetings_ok.groovy
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ priority 2
+ request {
+ method 'GET'
+ urlPath('/greeting') {
+ queryParameters {
+ parameter 'name': 'Something'
+ }
+ }
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ }
+ response {
+ status 200
+ body(
+ id: 1,
+ content: "Hello, Something!"
+ )
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/test/resources/contracts/greetings_with_default_value.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/test/resources/contracts/greetings_with_default_value.groovy
new file mode 100644
index 0000000000..5b65b65ca7
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/src/test/resources/contracts/greetings_with_default_value.groovy
@@ -0,0 +1,33 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ priority 2
+ request {
+ method 'GET'
+ url('/greeting')
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ }
+ response {
+ status 200
+ body(
+ id: 1,
+ content: "Hello, World!"
+ )
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/pomless/Sample.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/pomless/Sample.groovy
new file mode 100644
index 0000000000..094820225b
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/pomless/Sample.groovy
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ request {
+ method 'POST'
+ url('/users') {
+
+ }
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ body '''{ "login" : "john", "name": "John The Contract" }'''
+ }
+ response {
+ status 200
+ headers {
+ header 'Location': '/users/john'
+ }
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml
new file mode 100644
index 0000000000..b925aca3d1
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml
@@ -0,0 +1,145 @@
+
+
+
+ 4.0.0
+
+ org.springframework
+ gs-rest-service
+ 0.1.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.5.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+ org.spockframework
+ spock-core
+ test
+
+
+ com.jayway.restassured
+ rest-assured
+ 2.9.0
+ test
+
+
+ com.jayway.restassured
+ spring-mock-mvc
+ 2.9.0
+ test
+
+
+ com.toomuchcoding.jsonassert
+ jsonassert
+ 0.4.7
+ test
+
+
+
+
+
+ 1.8
+ ${it-plugin.version}
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-maven-plugin
+ ${accurest-plugin.version}
+
+
+
+ convert
+ generateStubs
+ generateTests
+
+
+
+
+ hello.BaseAccurest
+ SPOCK
+
+
+
+
+ org.codehaus.gmavenplus
+ gmavenplus-plugin
+ 1.5
+
+
+
+ testCompile
+
+
+
+
+
+
+ ${project.basedir}/src/test/groovy
+
+ **/*.groovy
+
+
+
+ ${project.build.directory}/generated-test-sources/contracts
+
+ **/*.groovy
+
+
+
+
+
+
+ maven-surefire-plugin
+ 2.19
+
+
+ **/*Spec.java
+
+
+
+
+
+
+
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/main/java/hello/Application.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/main/java/hello/Application.java
new file mode 100644
index 0000000000..bb79fe49da
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/main/java/hello/Application.java
@@ -0,0 +1,28 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/main/java/hello/Greeting.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/main/java/hello/Greeting.java
new file mode 100644
index 0000000000..f22f746a8f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/main/java/hello/Greeting.java
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+public class Greeting {
+
+ private final long id;
+ private final String content;
+
+ public Greeting(long id, String content) {
+ this.id = id;
+ this.content = content;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getContent() {
+ return content;
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/main/java/hello/GreetingController.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/main/java/hello/GreetingController.java
new file mode 100644
index 0000000000..f6db9e06b9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/main/java/hello/GreetingController.java
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class GreetingController {
+
+ private static final String template = "Hello, %s!";
+ private final AtomicLong counter = new AtomicLong();
+
+ @RequestMapping("/greeting")
+ public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
+ return new Greeting(counter.incrementAndGet(),
+ String.format(template, name));
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/test/groovy/hello/BaseAccurest.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/test/groovy/hello/BaseAccurest.groovy
new file mode 100644
index 0000000000..82707cf2ef
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/test/groovy/hello/BaseAccurest.groovy
@@ -0,0 +1,28 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello
+
+import com.jayway.restassured.module.mockmvc.RestAssuredMockMvc
+import spock.lang.Specification
+
+public class BaseAccurest extends Specification {
+
+ def setup() {
+ RestAssuredMockMvc.standaloneSetup(new GreetingController())
+ }
+
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/test/resources/contracts/greetings_ok.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/test/resources/contracts/greetings_ok.groovy
new file mode 100644
index 0000000000..e782af7b50
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/test/resources/contracts/greetings_ok.groovy
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ priority 2
+ request {
+ method 'GET'
+ urlPath('/greeting') {
+ queryParameters {
+ parameter 'name': 'Something'
+ }
+ }
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ }
+ response {
+ status 200
+ body (
+ id: 1,
+ content: "Hello, Something!"
+ )
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/test/resources/contracts/greetings_with_default_value.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/test/resources/contracts/greetings_with_default_value.groovy
new file mode 100644
index 0000000000..ad5e45965c
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/src/test/resources/contracts/greetings_with_default_value.groovy
@@ -0,0 +1,33 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ priority 2
+ request {
+ method 'GET'
+ url('/greeting')
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ }
+ response {
+ status 200
+ body (
+ id: 1,
+ content: "Hello, World!"
+ )
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/pom.xml
new file mode 100644
index 0000000000..26dd0112b4
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/pom.xml
@@ -0,0 +1,110 @@
+
+
+
+ 4.0.0
+
+ org.springframework
+ gs-rest-service
+ 0.1.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.5.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ ch.qos.logback
+ logback-classic
+
+
+
+
+
+ com.jayway.restassured
+ rest-assured
+ 2.9.0
+ test
+
+
+ com.jayway.restassured
+ spring-mock-mvc
+ 2.9.0
+ test
+
+
+ com.toomuchcoding.jsonassert
+ jsonassert
+ 0.4.7
+ test
+
+
+ org.assertj
+ assertj-core
+ 2.4.1
+ test
+
+
+
+
+
+ 1.8
+ ${it-plugin.version}
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-maven-plugin
+ ${accurest-plugin.version}
+
+
+
+ convert
+ generateStubs
+ generateTests
+
+
+
+
+ hello.BaseAccurest
+
+
+
+
+
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/main/java/hello/Application.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/main/java/hello/Application.java
new file mode 100644
index 0000000000..bb79fe49da
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/main/java/hello/Application.java
@@ -0,0 +1,28 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/main/java/hello/Greeting.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/main/java/hello/Greeting.java
new file mode 100644
index 0000000000..f22f746a8f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/main/java/hello/Greeting.java
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+public class Greeting {
+
+ private final long id;
+ private final String content;
+
+ public Greeting(long id, String content) {
+ this.id = id;
+ this.content = content;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getContent() {
+ return content;
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/main/java/hello/GreetingController.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/main/java/hello/GreetingController.java
new file mode 100644
index 0000000000..f6db9e06b9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/main/java/hello/GreetingController.java
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class GreetingController {
+
+ private static final String template = "Hello, %s!";
+ private final AtomicLong counter = new AtomicLong();
+
+ @RequestMapping("/greeting")
+ public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
+ return new Greeting(counter.incrementAndGet(),
+ String.format(template, name));
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/test/java/hello/BaseAccurest.java b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/test/java/hello/BaseAccurest.java
new file mode 100644
index 0000000000..5d04fddb2f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/test/java/hello/BaseAccurest.java
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hello;
+
+import com.jayway.restassured.module.mockmvc.RestAssuredMockMvc;
+
+import org.junit.Before;
+
+public class BaseAccurest {
+
+ @Before
+ public void setup() {
+ RestAssuredMockMvc.standaloneSetup(new GreetingController());
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/test/resources/contracts/greetings_ok.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/test/resources/contracts/greetings_ok.groovy
new file mode 100644
index 0000000000..4a5d9a792f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/test/resources/contracts/greetings_ok.groovy
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ priority 2
+ request {
+ method 'GET'
+ urlPath('/greeting') {
+ queryParameters {
+ parameter 'name': 'Something'
+ }
+ }
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ }
+ response {
+ status 200
+ body(
+ id: 1,
+ content: "Hello, Something!"
+ )
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/test/resources/contracts/greetings_with_default_value.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/test/resources/contracts/greetings_with_default_value.groovy
new file mode 100644
index 0000000000..5b65b65ca7
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/src/test/resources/contracts/greetings_with_default_value.groovy
@@ -0,0 +1,33 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ priority 2
+ request {
+ method 'GET'
+ url('/greeting')
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ }
+ response {
+ status 200
+ body(
+ id: 1,
+ content: "Hello, World!"
+ )
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/withStubs/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/withStubs/pom.xml
new file mode 100644
index 0000000000..e7ee761ca9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/withStubs/pom.xml
@@ -0,0 +1,37 @@
+
+
+
+ 4.0.0
+
+ io.codearte.accurest.sample
+ sample-project
+ 0.1
+
+
+
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-maven-plugin
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/withStubs/src/test/resources/stubs/Sample.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/withStubs/src/test/resources/stubs/Sample.groovy
new file mode 100644
index 0000000000..094820225b
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/withStubs/src/test/resources/stubs/Sample.groovy
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.springframework.cloud.contract.spec.Contract.make {
+ request {
+ method 'POST'
+ url('/users') {
+
+ }
+ headers {
+ header 'Content-Type': 'application/json'
+ }
+ body '''{ "login" : "john", "name": "John The Contract" }'''
+ }
+ response {
+ status 200
+ headers {
+ header 'Location': '/users/john'
+ }
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/.gitignore b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/.gitignore
new file mode 100644
index 0000000000..05f150069a
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/.gitignore
@@ -0,0 +1,11 @@
+*.class
+*.iml
+
+.idea/
+.gradle/
+target/
+build/
+
+hs_err_pid*
+.DS_Store
+*.log
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/LICENSE b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/LICENSE
new file mode 100644
index 0000000000..e06d208186
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/LICENSE
@@ -0,0 +1,202 @@
+Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/README.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/README.adoc
new file mode 100644
index 0000000000..9bd94b36f0
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/README.adoc
@@ -0,0 +1,221 @@
+// Do not edit this file (e.g. go instead to src/main/asciidoc)
+
+:core_path: ../../../..
+:verifier_root_path: {core_path}/spring-cloud-contract-verifier
+:verifier_core_path: {verifier_root_path}/spring-cloud-contract-verifier-core
+:stubrunner_core_path: {core_path}/spring-cloud-contract-stub-runner
+:documentation_url: http://codearte.github.io/accurest
+
+= Spring Cloud Contract Verifier
+
+:images_url: https://raw.githubusercontent.com/Codearte/accurest/master/docs/src/main/asciidoc/images
+
+== Introduction
+
+IMPORTANT: http://codearte.github.io/accurest/deprecated[The documentation to the deprecated Accurest project in version 1.1.0 is available here.]
+
+TIP: The Accurest project was initially started by Marcin Grzejszczak and Jakub Kubrynski (http://codearte.io[codearte.io])
+
+Just to make long story short - Spring Cloud Contract Verifier is a tool that enables Consumer Driven Contract (CDC) development of JVM-based applications. It is shipped
+with __Contract Definition Language__ (DSL). Contract definitions are used to produce following resources:
+
+* JSON stub definitions to be used by Wiremock when doing integration testing on the client code (__client tests__).
+Test code must still be written by hand, test data is produced by Spring Cloud Contract Verifier.
+* Messaging routes if you're using one. We're integrating with Spring Integration, Spring Cloud Stream and Apache Camel. You can however set your own integrations if you want to
+* Acceptance tests (in JUnit or Spock) used to verify if server-side implementation of the API is compliant with the contract (__server tests__).
+Full test is generated by Spring Cloud Contract Verifier.
+
+Spring Cloud Contract Verifier moves TDD to the level of software architecture.
+
+=== Why?
+
+Let us assume that we have a system comprising of multiple microservices:
+
+image::{images_url}/Deps.png[Microservices Architecture]
+
+==== Testing issues
+
+If we wanted to test the application in top left corner if it can communicate with other services then we could do one of two things:
+
+- deploy all microservices and perform end to end tests
+- mock other microservices in unit / integration tests
+
+Both have their advantages but also a lot of disadvantages. Let's focus on the latter.
+
+*Deploy all microservices and perform end to end tests*
+
+Advantages:
+
+- simulates production
+- tests real communication between services
+
+Disadvantages:
+
+- to test one microservice we would have to deploy 6 microservices, a couple of databases etc.
+- the environment where the tests would be conducted would be locked for a single suite of tests (i.e. nobody else would be able to run the tests in the meantime).
+- long to run
+- very late feedback
+- extremely hard to debug
+
+*Mock other microservices in unit / integration tests*
+
+Advantages:
+
+- very fast feedback
+- no infrastructure requirements
+
+Disadvantages:
+
+- the implementor of the service creates stubs thus they might have nothing to do with the reality
+- you can go to production with passing tests and failing production
+
+To solve the aforementioned issues Spring Cloud Contract Verifier with Stub Runner were created. Their main idea is to give you very fast feedback, without the need
+to set up the whole world of microservices.
+
+image::{images_url}/Stubs1.png[Stubbed Services]
+
+If you work on stubs then the only applications you need are those that your application is using directly.
+
+image::{images_url}/Stubs2.png[Stubbed Services]
+
+Spring Cloud Contract Verifier gives you the certainty that the stubs that you're using were created by the service that you're calling. Also if you can use them it means that they were
+tested against the producer's side. In other words - you can trust those stubs.
+
+
+=== Purposes
+
+The main purposes of Spring Cloud Contract Verifier with Stub Runner are:
+
+ - to ensure that WireMock / Messaging stubs (used when developing the client) are doing exactly what actual server-side implementation will do,
+ - to promote ATDD method and Microservices architectural style,
+ - to provide a way to publish changes in contracts that are immediately visible on both sides,
+ - to generate boilerplate test code used on the server side.
+
+=== Client Side
+
+During the tests you want to have a Wiremock instance / Messaging route up and running that simulates the service Y.
+You would like to feed that instance with a proper stub definition. That stub definition would need
+to be valid and should also be reusable on the server side.
+
+__Summing it up:__ On this side, in the stub definition, you can use patterns for request stubbing and you need exact
+values for responses.
+
+=== Server Side
+
+Being a service Y since you are developing your stub, you need to be sure that it's actually resembling your
+concrete implementation. You can't have a situation where your stub acts in one way and your application on
+production behaves in a different way.
+
+That's why from the provided stub acceptance tests will be generated that will ensure
+that your application behaves in the same way as you define in your stub.
+
+__Summing it up:__ On this side, in the stub definition, you need exact values as request and can use patterns/methods
+for response verification.
+
+=== Dependencies
+
+Spring Cloud Contract Verifier and Stub Runner are using the following libraries
+
+- http://wiremock.org/[WireMock]
+- https://github.com/jayway/JsonPath[Jayway JSONPath]
+- https://github.com/marcingrzejszczak/jsonassert[JSONAssert from Marcin Grzejszczak]
+
+=== Additional links
+
+Below you can find some resources related to Spring Cloud Contract Verifier and Stub Runner. Note that some can be outdated since the Spring Cloud Contract Verifier project
+is under constant development.
+
+==== Videos
+
+*Olga Maciaszek-Sharma talking about Accurest (Spring Cloud Contract Verifier predecessor)*
+
+video::daafmTYFoDU[youtube]
+
+*Marcin Grzejszczak and Jakub Kubryński talking about Accurest (Spring Cloud Contract Verifier predecessor)*
+
+video::130779882[vimeo]
+
+==== Readings
+
+- http://www.slideshare.net/MarcinGrzejszczak/stick-to-the-rules-consumer-driven-contracts-201507-confitura[Slides from Marcin Grzejszczak's talk about Accurest]
+- http://toomuchcoding.com/blog/categories/accurest/[Accurest related articles from Marcin Grzejszczak's blog]
+
+=== Samples
+
+Here you can find some https://github.com/Codearte/accurest-samples[working samples]. Check the readme of each project for more information.
+
+=== Why use Spring Cloud Contract Verifier and not X ?
+
+For the time being Spring Cloud Contract Verifier is a JVM based tool. So it could be your first pick when you're already creating
+software for the JVM. This project has a lot of really interesting features but especially quite a few of them definitely make
+Spring Cloud Contract Verifier stand out on the "market" of Consumer Driven Contract (CDC) tooling. Out of many the most interesting are:
+
+- Possibility to do CDC with messaging
+- Clear and easy to use, statically typed DSL
+- Possibility to copy paste your current JSON file to the contract and only edit its elements
+- Automatic generation of tests from the defined Contract
+- Stub Runner functionality - the stubs are automatically downloaded at runtime from Nexus / Artifactory
+- Spring Cloud integration - no discovery service is needed for integration tests
+
+== Links
+
+Here you can find interesting links related to Spring Cloud Contract Verifier:
+
+- https://github.com/Codearte/accurest[Spring Cloud Contract Verifier Github Repository]
+- http://codearte.github.io/accurest[Spring Cloud Contract Verifier Documentation]
+- http://codearte.github.io/accurest/deprecated[Accurest Legacy Documentation]
+- https://codearte.github.io/accurest/#spring-cloud-contract-stub-runner[Spring Cloud Contract Stub Runner Documentation]
+- http://codearte.github.io/accurest/#stub-runner-for-messaging[Spring Cloud Contract Stub Runner Messaging Documentation]
+- https://gitter.im/Codearte/accurest[Spring Cloud Contract Verifier Gitter]
+- https://github.com/Codearte/accurest-maven-plugin[Spring Cloud Contract Verifier Maven Plugin]
+
+== Documentation
+
+You can read more about Spring Cloud Contract Verifier by reading the {documentation_url}[docs]
+
+== Contributing
+
+Spring Cloud is released under the non-restrictive Apache 2.0 license,
+and follows a very standard Github development process, using Github
+tracker for issues and merging pull requests into master. If you want
+to contribute even something trivial please do not hesitate, but
+follow the guidelines below.
+
+=== Sign the Contributor License Agreement
+Before we accept a non-trivial patch or pull request we will need you to sign the
+https://support.springsource.com/spring_committer_signup[contributor's agreement].
+Signing the contributor's agreement does not grant anyone commit rights to the main
+repository, but it does mean that we can accept your contributions, and you will get an
+author credit if we do. Active contributors might be asked to join the core team, and
+given the ability to merge pull requests.
+
+=== Code of Conduct
+This project adheres to the Contributor Covenant https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc[code of
+conduct]. By participating, you are expected to uphold this code. Please report
+unacceptable behavior to spring-code-of-conduct@pivotal.io.
+
+=== Code Conventions and Housekeeping
+None of these is essential for a pull request, but they will all help. They can also be
+added after the original pull request but before a merge.
+
+* Use the Spring Framework code format conventions. If you use Eclipse
+ you can import formatter settings using the
+ `eclipse-code-formatter.xml` file from the
+ https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring
+ Cloud Build] project. If using IntelliJ, you can use the
+ http://plugins.jetbrains.com/plugin/6546[Eclipse Code Formatter
+ Plugin] to import the same file.
+* Make sure all new `.java` files to have a simple Javadoc class comment with at least an
+ `@author` tag identifying you, and preferably at least a paragraph on what the class is
+ for.
+* Add the ASF license header comment to all new `.java` files (copy from existing files
+ in the project)
+* Add yourself as an `@author` to the .java files that you modify substantially (more
+ than cosmetic changes).
+* Add some Javadocs and, if you change the namespace, some XSD doc elements.
+* A few unit tests would help a lot as well -- someone has to do it.
+* If no-one else is using your branch, please rebase it against the current master (or
+ other target branch in the main project).
+* When writing a commit message please follow http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions],
+ if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit
+ message (where XXXX is the issue number).
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/asciidoctor.css b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/asciidoctor.css
new file mode 100644
index 0000000000..06d52e688a
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/asciidoctor.css
@@ -0,0 +1,399 @@
+/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
+/* Remove the comments around the @import statement below when using this as a custom stylesheet */
+/*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic|Noto+Serif:400,400italic,700,700italic|Droid+Sans+Mono:400";*/
+article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}
+audio,canvas,video{display:inline-block}
+audio:not([controls]){display:none;height:0}
+[hidden],template{display:none}
+script{display:none!important}
+html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
+body{margin:0}
+a{background:transparent}
+a:focus{outline:thin dotted}
+a:active,a:hover{outline:0}
+h1{font-size:2em;margin:.67em 0}
+abbr[title]{border-bottom:1px dotted}
+b,strong{font-weight:bold}
+dfn{font-style:italic}
+hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}
+mark{background:#ff0;color:#000}
+code,kbd,pre,samp{font-family:monospace;font-size:1em}
+pre{white-space:pre-wrap}
+q{quotes:"\201C" "\201D" "\2018" "\2019"}
+small{font-size:80%}
+sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
+sup{top:-.5em}
+sub{bottom:-.25em}
+img{border:0}
+svg:not(:root){overflow:hidden}
+figure{margin:0}
+fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
+legend{border:0;padding:0}
+button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
+button,input{line-height:normal}
+button,select{text-transform:none}
+button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}
+button[disabled],html input[disabled]{cursor:default}
+input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}
+input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}
+input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}
+button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
+textarea{overflow:auto;vertical-align:top}
+table{border-collapse:collapse;border-spacing:0}
+*,*:before,*:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}
+html,body{font-size:100%}
+body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:auto}
+a:hover{cursor:pointer}
+img,object,embed{max-width:100%;height:auto}
+object,embed{height:100%}
+img{-ms-interpolation-mode:bicubic}
+#map_canvas img,#map_canvas embed,#map_canvas object,.map_canvas img,.map_canvas embed,.map_canvas object{max-width:none!important}
+.left{float:left!important}
+.right{float:right!important}
+.text-left{text-align:left!important}
+.text-right{text-align:right!important}
+.text-center{text-align:center!important}
+.text-justify{text-align:justify!important}
+.hide{display:none}
+.antialiased,body{-webkit-font-smoothing:antialiased}
+img{display:inline-block;vertical-align:middle}
+textarea{height:auto;min-height:50px}
+select{width:100%}
+p.lead,.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{font-size:1.21875em;line-height:1.6}
+.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}
+div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr}
+a{color:#2156a5;text-decoration:underline;line-height:inherit}
+a:hover,a:focus{color:#1d4b8f}
+a img{border:none}
+p{font-family:inherit;font-weight:400;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}
+p aside{font-size:.875em;line-height:1.35;font-style:italic}
+h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}
+h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}
+h1{font-size:2.125em}
+h2{font-size:1.6875em}
+h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}
+h4,h5{font-size:1.125em}
+h6{font-size:1em}
+hr{border:solid #ddddd8;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0}
+em,i{font-style:italic;line-height:inherit}
+strong,b{font-weight:bold;line-height:inherit}
+small{font-size:60%;line-height:inherit}
+code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
+ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
+ul,ol,ul.no-bullet,ol.no-bullet{margin-left:1.5em}
+ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em}
+ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit}
+ul.square{list-style-type:square}
+ul.circle{list-style-type:circle}
+ul.disc{list-style-type:disc}
+ul.no-bullet{list-style:none}
+ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
+dl dt{margin-bottom:.3125em;font-weight:bold}
+dl dd{margin-bottom:1.25em}
+abbr,acronym{text-transform:uppercase;font-size:90%;color:rgba(0,0,0,.8);border-bottom:1px dotted #ddd;cursor:help}
+abbr{text-transform:none}
+blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}
+blockquote cite{display:block;font-size:.9375em;color:rgba(0,0,0,.6)}
+blockquote cite:before{content:"\2014 \0020"}
+blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,.6)}
+blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}
+@media only screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}
+h1{font-size:2.75em}
+h2{font-size:2.3125em}
+h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}
+h4{font-size:1.4375em}}table{background:#fff;margin-bottom:1.25em;border:solid 1px #dedede}
+table thead,table tfoot{background:#f7f8f7;font-weight:bold}
+table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}
+table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}
+table tr.even,table tr.alt,table tr:nth-of-type(even){background:#f8f8f7}
+table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6}
+h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}
+h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}
+.clearfix:before,.clearfix:after,.float-group:before,.float-group:after{content:" ";display:table}
+.clearfix:after,.float-group:after{clear:both}
+*:not(pre)>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background-color:#f7f7f8;-webkit-border-radius:4px;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}
+pre,pre>code{line-height:1.45;color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;text-rendering:optimizeSpeed}
+.keyseq{color:rgba(51,51,51,.8)}
+kbd{display:inline-block;color:rgba(0,0,0,.8);font-size:.75em;line-height:1.4;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:-.15em .15em 0 .15em;padding:.2em .6em .2em .5em;vertical-align:middle;white-space:nowrap}
+.keyseq kbd:first-child{margin-left:0}
+.keyseq kbd:last-child{margin-right:0}
+.menuseq,.menu{color:rgba(0,0,0,.8)}
+b.button:before,b.button:after{position:relative;top:-1px;font-weight:400}
+b.button:before{content:"[";padding:0 3px 0 2px}
+b.button:after{content:"]";padding:0 2px 0 3px}
+p a>code:hover{color:rgba(0,0,0,.9)}
+#header,#content,#footnotes,#footer{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}
+#header:before,#header:after,#content:before,#content:after,#footnotes:before,#footnotes:after,#footer:before,#footer:after{content:" ";display:table}
+#header:after,#content:after,#footnotes:after,#footer:after{clear:both}
+#content{margin-top:1.25em}
+#content:before{content:none}
+#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
+#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #ddddd8}
+#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #ddddd8;padding-bottom:8px}
+#header .details{border-bottom:1px solid #ddddd8;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap}
+#header .details span:first-child{margin-left:-.125em}
+#header .details span.email a{color:rgba(0,0,0,.85)}
+#header .details br{display:none}
+#header .details br+span:before{content:"\00a0\2013\00a0"}
+#header .details br+span.author:before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)}
+#header .details br+span#revremark:before{content:"\00a0|\00a0"}
+#header #revnumber{text-transform:capitalize}
+#header #revnumber:after{content:"\00a0"}
+#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #ddddd8;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}
+#toc{border-bottom:1px solid #efefed;padding-bottom:.5em}
+#toc>ul{margin-left:.125em}
+#toc ul.sectlevel0>li>a{font-style:italic}
+#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}
+#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none}
+#toc a{text-decoration:none}
+#toc a:active{text-decoration:underline}
+#toctitle{color:#7a2518;font-size:1.2em}
+@media only screen and (min-width:768px){#toctitle{font-size:1.375em}
+body.toc2{padding-left:15em;padding-right:0}
+#toc.toc2{margin-top:0!important;background-color:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #efefed;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
+#toc.toc2 #toctitle{margin-top:0;font-size:1.2em}
+#toc.toc2>ul{font-size:.9em;margin-bottom:0}
+#toc.toc2 ul ul{margin-left:0;padding-left:1em}
+#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
+body.toc2.toc-right{padding-left:0;padding-right:15em}
+body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #efefed;left:auto;right:0}}@media only screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}
+#toc.toc2{width:20em}
+#toc.toc2 #toctitle{font-size:1.375em}
+#toc.toc2>ul{font-size:.95em}
+#toc.toc2 ul ul{padding-left:1.25em}
+body.toc2.toc-right{padding-left:0;padding-right:20em}}#content #toc{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}
+#content #toc>:first-child{margin-top:0}
+#content #toc>:last-child{margin-bottom:0}
+#footer{max-width:100%;background-color:rgba(0,0,0,.8);padding:1.25em}
+#footer-text{color:rgba(255,255,255,.8);line-height:1.44}
+.sect1{padding-bottom:.625em}
+@media only screen and (min-width:768px){.sect1{padding-bottom:1.25em}}.sect1+.sect1{border-top:1px solid #efefed}
+#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
+#content h1>a.anchor:before,h2>a.anchor:before,h3>a.anchor:before,#toctitle>a.anchor:before,.sidebarblock>.content>.title>a.anchor:before,h4>a.anchor:before,h5>a.anchor:before,h6>a.anchor:before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
+#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}
+#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}
+#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}
+.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}
+.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic}
+table.tableblock>caption.title{white-space:nowrap;overflow:visible;max-width:0}
+.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{color:rgba(0,0,0,.85)}
+table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inherit}
+.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
+.admonitionblock>table td.icon{text-align:center;width:80px}
+.admonitionblock>table td.icon img{max-width:none}
+.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
+.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8;color:rgba(0,0,0,.6)}
+.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
+.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px}
+.exampleblock>.content>:first-child{margin-top:0}
+.exampleblock>.content>:last-child{margin-bottom:0}
+.sidebarblock{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}
+.sidebarblock>:first-child{margin-top:0}
+.sidebarblock>:last-child{margin-bottom:0}
+.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
+.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
+.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#f7f7f8}
+.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#f2f1f1}
+.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;padding:1em;font-size:.8125em}
+.literalblock pre.nowrap,.literalblock pre[class].nowrap,.listingblock pre.nowrap,.listingblock pre[class].nowrap{overflow-x:auto;white-space:pre;word-wrap:normal}
+@media only screen and (min-width:768px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:.90625em}}@media only screen and (min-width:1280px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:1em}}.literalblock.output pre{color:#f7f7f8;background-color:rgba(0,0,0,.9)}
+.listingblock pre.highlightjs{padding:0}
+.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px}
+.listingblock pre.prettyprint{border-width:0}
+.listingblock>.content{position:relative}
+.listingblock code[data-lang]:before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:#999}
+.listingblock:hover code[data-lang]:before{display:block}
+.listingblock.terminal pre .command:before{content:attr(data-prompt);padding-right:.5em;color:#999}
+.listingblock.terminal pre .command:not([data-prompt]):before{content:"$"}
+table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:none}
+table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0}
+table.pyhltable td.code{padding-left:.75em;padding-right:0}
+pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #ddddd8}
+pre.pygments .lineno{display:inline-block;margin-right:.25em}
+table.pyhltable .linenodiv{background:none!important;padding-right:0!important}
+.quoteblock{margin:0 1em 1.25em 1.5em;display:table}
+.quoteblock>.title{margin-left:-1.5em;margin-bottom:.75em}
+.quoteblock blockquote,.quoteblock blockquote p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}
+.quoteblock blockquote{margin:0;padding:0;border:0}
+.quoteblock blockquote:before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}
+.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}
+.quoteblock .attribution{margin-top:.5em;margin-right:.5ex;text-align:right}
+.quoteblock .quoteblock{margin-left:0;margin-right:0;padding:.5em 0;border-left:3px solid rgba(0,0,0,.6)}
+.quoteblock .quoteblock blockquote{padding:0 0 0 .75em}
+.quoteblock .quoteblock blockquote:before{display:none}
+.verseblock{margin:0 1em 1.25em 1em}
+.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}
+.verseblock pre strong{font-weight:400}
+.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}
+.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
+.quoteblock .attribution br,.verseblock .attribution br{display:none}
+.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.05em;color:rgba(0,0,0,.6)}
+.quoteblock.abstract{margin:0 0 1.25em 0;display:block}
+.quoteblock.abstract blockquote,.quoteblock.abstract blockquote p{text-align:left;word-spacing:0}
+.quoteblock.abstract blockquote:before,.quoteblock.abstract blockquote p:first-of-type:before{display:none}
+table.tableblock{max-width:100%;border-collapse:separate}
+table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0}
+table.spread{width:100%}
+table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
+table.grid-all th.tableblock,table.grid-all td.tableblock{border-width:0 1px 1px 0}
+table.grid-all tfoot>tr>th.tableblock,table.grid-all tfoot>tr>td.tableblock{border-width:1px 1px 0 0}
+table.grid-cols th.tableblock,table.grid-cols td.tableblock{border-width:0 1px 0 0}
+table.grid-all *>tr>.tableblock:last-child,table.grid-cols *>tr>.tableblock:last-child{border-right-width:0}
+table.grid-rows th.tableblock,table.grid-rows td.tableblock{border-width:0 0 1px 0}
+table.grid-all tbody>tr:last-child>th.tableblock,table.grid-all tbody>tr:last-child>td.tableblock,table.grid-all thead:last-child>tr>th.tableblock,table.grid-rows tbody>tr:last-child>th.tableblock,table.grid-rows tbody>tr:last-child>td.tableblock,table.grid-rows thead:last-child>tr>th.tableblock{border-bottom-width:0}
+table.grid-rows tfoot>tr>th.tableblock,table.grid-rows tfoot>tr>td.tableblock{border-width:1px 0 0 0}
+table.frame-all{border-width:1px}
+table.frame-sides{border-width:0 1px}
+table.frame-topbot{border-width:1px 0}
+th.halign-left,td.halign-left{text-align:left}
+th.halign-right,td.halign-right{text-align:right}
+th.halign-center,td.halign-center{text-align:center}
+th.valign-top,td.valign-top{vertical-align:top}
+th.valign-bottom,td.valign-bottom{vertical-align:bottom}
+th.valign-middle,td.valign-middle{vertical-align:middle}
+table thead th,table tfoot th{font-weight:bold}
+tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7}
+tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}
+p.tableblock>code:only-child{background:none;padding:0}
+p.tableblock{font-size:1em}
+td>div.verse{white-space:pre}
+ol{margin-left:1.75em}
+ul li ol{margin-left:1.5em}
+dl dd{margin-left:1.125em}
+dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
+ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
+ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none}
+ul.unstyled,ol.unnumbered,ul.checklist{margin-left:.625em}
+ul.checklist li>p:first-child>.fa-check-square-o:first-child,ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em}
+ul.checklist li>p:first-child>input[type="checkbox"]:first-child{position:relative;top:1px}
+ul.inline{margin:0 auto .625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden}
+ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block}
+ul.inline>li>*{display:block}
+.unstyled dl dt{font-weight:400;font-style:normal}
+ol.arabic{list-style-type:decimal}
+ol.decimal{list-style-type:decimal-leading-zero}
+ol.loweralpha{list-style-type:lower-alpha}
+ol.upperalpha{list-style-type:upper-alpha}
+ol.lowerroman{list-style-type:lower-roman}
+ol.upperroman{list-style-type:upper-roman}
+ol.lowergreek{list-style-type:lower-greek}
+.hdlist>table,.colist>table{border:0;background:none}
+.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}
+td.hdlist1{padding-right:.75em;font-weight:bold}
+td.hdlist1,td.hdlist2{vertical-align:top}
+.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
+.colist>table tr>td:first-of-type{padding:0 .75em;line-height:1}
+.colist>table tr>td:last-of-type{padding:.25em 0}
+.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd}
+.imageblock.left,.imageblock[style*="float: left"]{margin:.25em .625em 1.25em 0}
+.imageblock.right,.imageblock[style*="float: right"]{margin:.25em 0 1.25em .625em}
+.imageblock>.title{margin-bottom:0}
+.imageblock.thumb,.imageblock.th{border-width:6px}
+.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}
+.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}
+.image.left{margin-right:.625em}
+.image.right{margin-left:.625em}
+a.image{text-decoration:none}
+span.footnote,span.footnoteref{vertical-align:super;font-size:.875em}
+span.footnote a,span.footnoteref a{text-decoration:none}
+span.footnote a:active,span.footnoteref a:active{text-decoration:underline}
+#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
+#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em 0;border-width:1px 0 0 0}
+#footnotes .footnote{padding:0 .375em;line-height:1.3;font-size:.875em;margin-left:1.2em;text-indent:-1.2em;margin-bottom:.2em}
+#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none}
+#footnotes .footnote:last-of-type{margin-bottom:0}
+#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}
+.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0}
+.gist .file-data>table td.line-data{width:99%}
+div.unbreakable{page-break-inside:avoid}
+.big{font-size:larger}
+.small{font-size:smaller}
+.underline{text-decoration:underline}
+.overline{text-decoration:overline}
+.line-through{text-decoration:line-through}
+.aqua{color:#00bfbf}
+.aqua-background{background-color:#00fafa}
+.black{color:#000}
+.black-background{background-color:#000}
+.blue{color:#0000bf}
+.blue-background{background-color:#0000fa}
+.fuchsia{color:#bf00bf}
+.fuchsia-background{background-color:#fa00fa}
+.gray{color:#606060}
+.gray-background{background-color:#7d7d7d}
+.green{color:#006000}
+.green-background{background-color:#007d00}
+.lime{color:#00bf00}
+.lime-background{background-color:#00fa00}
+.maroon{color:#600000}
+.maroon-background{background-color:#7d0000}
+.navy{color:#000060}
+.navy-background{background-color:#00007d}
+.olive{color:#606000}
+.olive-background{background-color:#7d7d00}
+.purple{color:#600060}
+.purple-background{background-color:#7d007d}
+.red{color:#bf0000}
+.red-background{background-color:#fa0000}
+.silver{color:#909090}
+.silver-background{background-color:#bcbcbc}
+.teal{color:#006060}
+.teal-background{background-color:#007d7d}
+.white{color:#bfbfbf}
+.white-background{background-color:#fafafa}
+.yellow{color:#bfbf00}
+.yellow-background{background-color:#fafa00}
+span.icon>.fa{cursor:default}
+.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
+.admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c}
+.admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
+.admonitionblock td.icon .icon-warning:before{content:"\f071";color:#bf6900}
+.admonitionblock td.icon .icon-caution:before{content:"\f06d";color:#bf3400}
+.admonitionblock td.icon .icon-important:before{content:"\f06a";color:#bf0000}
+.conum[data-value]{display:inline-block;color:#fff!important;background-color:rgba(0,0,0,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
+.conum[data-value] *{color:#fff!important}
+.conum[data-value]+b{display:none}
+.conum[data-value]:after{content:attr(data-value)}
+pre .conum[data-value]{position:relative;top:-.125em}
+b.conum *{color:inherit!important}
+.conum:not([data-value]):empty{display:none}
+h1,h2{letter-spacing:-.01em}
+dt,th.tableblock,td.content{text-rendering:optimizeLegibility}
+p,td.content{letter-spacing:-.01em}
+p strong,td.content strong{letter-spacing:-.005em}
+p,blockquote,dt,td.content{font-size:1.0625rem}
+p{margin-bottom:1.25rem}
+.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
+.exampleblock>.content{background-color:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc}
+.print-only{display:none!important}
+@media print{@page{margin:1.25cm .75cm}
+*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important}
+a{color:inherit!important;text-decoration:underline!important}
+a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
+a[href^="http:"]:not(.bare):after,a[href^="https:"]:not(.bare):after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
+abbr[title]:after{content:" (" attr(title) ")"}
+pre,blockquote,tr,img{page-break-inside:avoid}
+thead{display:table-header-group}
+img{max-width:100%!important}
+p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}
+h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}
+#toc,.sidebarblock,.exampleblock>.content{background:none!important}
+#toc{border-bottom:1px solid #ddddd8!important;padding-bottom:0!important}
+.sect1{padding-bottom:0!important}
+.sect1+.sect1{border:0!important}
+#header>h1:first-child{margin-top:1.25rem}
+body.book #header{text-align:center}
+body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em 0}
+body.book #header .details{border:0!important;display:block;padding:0!important}
+body.book #header .details span:first-child{margin-left:0!important}
+body.book #header .details br{display:block}
+body.book #header .details br+span:before{content:none!important}
+body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}
+body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}
+.listingblock code[data-lang]:before{display:block}
+#footer{background:none!important;padding:0 .9375em}
+#footer-text{color:rgba(0,0,0,.6)!important;font-size:.9em}
+.hide-on-print{display:none!important}
+.print-only{display:block!important}
+.hide-for-print{display:none!important}
+.show-for-print{display:inherit!important}}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/build.gradle b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/build.gradle
new file mode 100644
index 0000000000..82570396cb
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/build.gradle
@@ -0,0 +1,88 @@
+buildscript {
+ repositories {
+ mavenCentral()
+ mavenLocal()
+ maven { url 'https://repo.spring.io/plugins-release' }
+ if (project.hasProperty('fatJar')) jcenter()
+ }
+ dependencies {
+ classpath "com.bmuschko:gradle-nexus-plugin:2.3"
+ classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3"
+ if (project.hasProperty('fatJar')) classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
+ }
+}
+
+ext {
+ repoUser = System.getenv('REPO_USERNAME') ?: project.findProperty('REPO_USERNAME') ?: ''
+ repoPass = System.getenv('REPO_PASSWORD') ?: project.findProperty('REPO_PASSWORD') ?: ''
+ projectsToSkipPublication = ['parent', 'samples', 'docs', 'root']
+}
+
+allprojects {
+ project.version = findProperty('contractVerifierVersion') ?: '1.0.0.BUILD-SNAPSHOT'
+ apply from: "$rootDir/gradle/release.gradle"
+}
+
+subprojects {
+ apply plugin: 'groovy'
+
+ group = 'org.springframework.cloud.contract'
+
+ sourceCompatibility = 1.7
+ targetCompatibility = 1.7
+
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ jcenter()
+ maven { url "http://repo.spring.io/snapshot" }
+ maven { url "http://repo.spring.io/milestone" }
+ maven { url "http://repo.spring.io/libs-release-local" }
+ maven { url "http://repo.spring.io/libs-staging-local/" }
+ }
+
+ //Dependencies in all subprojects - http://solidsoft.wordpress.com/2014/11/13/gradle-tricks-display-dependencies-for-all-subprojects-in-multi-project-build/
+ task allDeps(type: DependencyReportTask) {}
+ task allInsight(type: DependencyInsightReportTask) {}
+
+ dependencies {
+ compile localGroovy()
+ testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
+ exclude(group: 'org.codehaus.groovy')
+ }
+ testCompile 'info.solidsoft.spock:spock-global-unroll:0.5.0'
+ }
+
+ test {
+ testLogging {
+ exceptionFormat = 'full'
+ }
+ }
+
+ // fixing the groovydoc issue http://stackoverflow.com/questions/20618857/gradle-task-groovydoc-failing-with-noclassdeffounderror
+ configurations {
+ jansi.extendsFrom(runtime)
+ }
+ groovydoc {
+ def title = "IPDS ${version}"
+ groovyClasspath = project.configurations.jansi
+ }
+ dependencies {
+ jansi 'org.fusesource.jansi:jansi:1.11'
+ }
+}
+
+configurations {
+ all {
+ resolutionStrategy {
+ eachDependency { DependencyResolveDetails details ->
+ // To prevent an accidental usage of groovy-all.jar and groovy.jar in different versions
+ // all modularized Groovy jars are replaced with groovy-all.jar by default.
+ if (details.requested.group == 'org.codehaus.groovy' && details.requested.name != "groovy-all") {
+ details.useTarget("org.codehaus.groovy:groovy-all:${details.requested.version}")
+ }
+ }
+ }
+ }
+}
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/build.sh b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/build.sh
new file mode 100755
index 0000000000..0a16b0b0e9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/build.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+./gradlew clean build --parallel
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/deploy.sh b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/deploy.sh
new file mode 100755
index 0000000000..8c061c8b65
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/deploy.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+./gradlew clean build install && ./scripts/runTests.sh && ./gradlew uploadArchives -x test
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/build.gradle b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/build.gradle
new file mode 100644
index 0000000000..2a79e0ef8f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/build.gradle
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+plugins {
+ id 'org.ajoberstar.github-pages' version '1.1.0'
+ id 'org.asciidoctor.gradle.asciidoctor' version '1.5.1'
+ id 'org.asciidoctor.convert' version '1.5.3'
+ id 'com.github.jruby-gradle.base' version '1.2.1'
+}
+
+
+apply plugin: 'org.asciidoctor.gradle.asciidoctor'
+apply plugin: 'com.github.jruby-gradle.base'
+
+dependencies {
+ gems group: 'rubygems', name: 'asciidoctor', version: '1.5.3'
+}
+
+asciidoctorj {
+ version = '1.5.4'
+}
+
+task generateReadme(type: com.github.jrubygradle.JRubyExec) {
+ dependsOn jrubyPrepare
+
+ description "Generates an output README.adoc"
+ script "${projectDir}/src/main/ruby/generate_readme.sh"
+ scriptArgs "-o${new File(project.rootDir, 'README.adoc')}"
+ gemWorkDir jrubyPrepare.outputDir
+}
+
+asciidoctor {
+ String backend = 'html'
+ dependsOn jrubyPrepare
+
+ resources {
+ from("src/main/asciidoc/") {
+ include '**/*.png'
+ include '**/*.jpg'
+ include '**/*.html'
+ }
+ into './'
+ }
+
+ sourceDir 'src/main/asciidoc'
+ backends backend
+ attributes 'build-gradle': file('build.gradle'),
+ 'endpoint-url': 'https://Codearte.github.io/accurest',
+ 'source-highlighter': 'coderay',
+ 'imagesdir': 'images',
+ 'toc': 'left',
+ 'icons': 'font',
+ 'setanchors': 'true',
+ 'idprefix': '',
+ 'idseparator': '-',
+ 'docinfo1': 'true',
+ 'doctype' : 'article'
+
+ gemPath = jrubyPrepare.outputDir
+}
+
+generateReadme.dependsOn asciidoctor
+publishGhPages.dependsOn asciidoctor
+
+githubPages {
+ repoUri = 'https://github.com/Codearte/accurest'
+ credentials {
+ username = project.hasProperty('githubToken') ? project.githubToken : ''
+ password = project.hasProperty('githubPass') ? project.githubPass : ''
+ }
+
+ pages {
+ from('build/asciidoc/html') {
+ include '**/'
+ }
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/README.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/README.adoc
new file mode 100644
index 0000000000..cc85698563
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/README.adoc
@@ -0,0 +1,19 @@
+:core_path: ../../../..
+:verifier_root_path: {core_path}/spring-cloud-contract-verifier
+:verifier_core_path: {verifier_root_path}/spring-cloud-contract-verifier-core
+:stubrunner_core_path: {core_path}/spring-cloud-contract-stub-runner
+:documentation_url: http://codearte.github.io/accurest
+
+= Spring Cloud Contract Verifier
+
+include::introduction.adoc[]
+
+include::links.adoc[]
+
+== Documentation
+
+You can read more about Spring Cloud Contract Verifier by reading the {documentation_url}[docs]
+
+== Contributing
+
+include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/contract.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/contract.adoc
new file mode 100644
index 0000000000..a846910959
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/contract.adoc
@@ -0,0 +1,220 @@
+:core_path: ../../../..
+:verifier_root_path: {core_path}/spring-cloud-contract-verifier
+:verifier_core_path: {verifier_root_path}/spring-cloud-contract-verifier-core
+
+== Contract DSL
+
+IMPORTANT: Remember that inside the contract file you have to provide the fully qualified name to
+the `Contract` class and the `make` static import i.e. `org.springframework.cloud.contract.spec.Contract.make { ... }`.
+You can also provide an import to the `Contract` class `import org.springframework.cloud.contract.spec.Contract` and then call
+ `Contract.make { ... }`
+
+Contract DSL is written in Groovy, but don't be alarmed if you didn't use Groovy before. Knowledge of the language is not really needed as our DSL uses only
+a tiny subset of it (namely literals, method calls and closures). What's more the DSL is designed to be programmer-readable without any knowledge of the DSL itself -
+ it's statically typed.
+
+The Contract is present in the `spring-cloud-contract-spec` module of the Spring Cloud Contract Verifier repository.
+
+Let's look at full example of a contract definition.
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MockMvcMethodBodyBuilderSpec.groovy[tags=dsl_example,indent=0]
+----
+
+Not all features of the DSL are used in example above. If you didn't find what you are looking for, please check next paragraphs on this page.
+
+> You can easily compile Contracts to WireMock stubs mapping using standalone maven command: `mvn org.springframework.cloud.contract:spring-cloud-contract-verifier-maven-plugin:convert`.
+
+=== Limitations
+
+WARNING: Spring Cloud Contract Verifier doesn't support XML properly. Please use JSON or help us implement this feature.
+
+WARNING: Spring Cloud Contract Verifier supports equality check on text response. Regular expressions are not yet available.
+
+WARNING: The support for the verification of size of JSON arrays is experimental. If you want to turn it on please provide
+the value of a system property `spring.cloud.contract.verifier.assert.size` equal to `true`. By default this feature is set to
+`false`. You can also provide the `assertJsonSize` property in the plugin configuration.
+
+=== HTTP Top-Level Elements
+
+Following methods can be called in the top-level closure of a contract definition. Request and response are mandatory, priority is optional.
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=http_dsl,indent=0]
+----
+
+=== Request
+
+HTTP protocol requires only **method and address** to be specified in a request. The same information is mandatory in request definition of the Contract.
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=request,indent=0]
+----
+
+It is possible to specify whole `url` instead of just path, but `urlPath` is the recommended way as it makes the tests **host-independent**.
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=url,indent=0]
+
+----
+
+Request may contain **query parameters**, which are specified in a closure nested in a call to `urlPath` or `url`.
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=urlpath,indent=0]
+----
+
+It may contain additional **request headers**...
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=headers,indent=0]
+----
+
+...and a **request body**.
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=body,indent=0]
+----
+
+**Body's format** can also be specified explicitly by invoking one of format functions.
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=bodyAsXml,indent=0]
+----
+
+=== Response
+
+Minimal response must contain **HTTP status code**.
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=response,indent=0]
+----
+
+Besides status response may contain **headers** and **body**, which are specified the same way as in the request (see previous paragraph).
+
+=== Regular expressions
+You can use regular expressions to write your requests in Contract DSL. It is particularly useful when you want to indicate that a given response
+should be provided for requests that follow a given pattern. Also, you can use it when you need to use patterns and not exact values both
+for your test and your server side tests.
+
+Please see the example below:
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=regex,indent=0]
+----
+
+=== Passing optional parameters
+
+It is possible to provide optional parameters in your contract. It's only possible to have optional parameter for the:
+
+- __STUB__ side of the Request
+- __TEST__ side of the Response
+
+Example:
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=optionals,indent=0]
+----
+
+By wrapping a part of the body with the `optional()` method you are in fact creating a regular expression that should be present 0 or more times.
+
+That way for the example above the following test would be generated if you pick Spock:
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=optionals_test,indent=0]
+----
+
+and the following stub:
+
+[source,javascript,indent=0]
+----
+include::{verifier_root_path}/spring-cloud-contract-verifier-converters/src/test/groovy/org/springframework/cloud/contract/verifier/wiremock/DslToWireMockClientConverterSpec.groovy[tags=wiremock,indent=0]
+----
+
+=== Executing custom methods on server side
+It is also possible to define a method call to be executed on the server side during the test. Such a method can be added to the class defined as "baseClassForTests"
+in the configuration. Please see the examples below:
+
+==== Contract DSL
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=method,indent=0]
+----
+
+==== Base Mock Spec
+
+[source,groovy,indent=0]
+----
+include::{verifier_root_path}/spring-cloud-contract-verifier-gradle-plugin/src/test/resources/functionalTest/bootSimple/src/test/groovy/org/springframework/cloud/contract/verifier/twitter/places/BaseMockMvcSpec.groovy[tags=base_class,indent=0]
+----
+
+=== JAX-RS support
+Starting with release 0.8.0 we support JAX-RS 2 Client API. Base class needs to define `protected WebTarget webTarget` and server initialization, right now the only option how to test JAX-RS API is to start a web server.
+
+Request with a body needs to have a content type set otherwise `application/octet-stream` is going to be used.
+
+In order to use JAX-RS mode, use the following settings:
+
+[source,groovy,indent=0]
+----
+testMode == 'JAXRSCLIENT'
+----
+
+Example of a test API generated:
+
+[source,groovy,indent=0]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/JaxRsClientMethodBuilderSpec.groovy[tags=jaxrs,indent=0]
+----
+
+=== Messaging Top-Level Elements
+
+The DSL for messaging looks a little bit different than the one that focuses on HTTP.
+
+==== Output triggered by a method
+
+The output message can be triggered by calling a method (e.g. a Scheduler was started and a message was sent)
+
+[source,groovy]
+----
+include::../../../../samples/samples-messaging-integration/src/test/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplicationSpec.groovy[tags=method_trigger,indent=0]
+----
+
+In this case the output message will be sent to `output` if a method called `bookReturnedTriggered` will be executed. In the message *publisher's* side
+we will generate a test that will call that method to trigger the message. On the *consumer* side you can use the `some_label` to trigger the message.
+
+==== Output triggered by a message
+
+The output message can be triggered by receiving a message.
+
+[source,groovy]
+----
+include::../../../../samples/samples-messaging-integration/src/test/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplicationSpec.groovy[tags=message_trigger,indent=0]
+----
+
+In this case the output message will be sent to `output` if a proper message will be received on the `input` destination. In the message *publisher's* side
+we will generate a test that will send the input message to the defined destination. On the *consumer* side you can either send a message to the input
+destination or use the `some_label` to trigger the message.
+
+==== Consumer / Producer
+
+In HTTP you have a notion of `client`/`stub and `server`/`test` notation. You can use them also in messaging but we're providing also the `consumer` and `produer` methods
+as presented below (note you can use either `$` or `value` methods to provide `consumer` and `producer` parts)
+
+[source,groovy]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MessagingMethodBodyBuilderSpec.groovy[tags=consumer_producer]
+----
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/contract.html b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/contract.html
new file mode 100644
index 0000000000..a210b8ade0
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/contract.html
@@ -0,0 +1,1232 @@
+
+
+
+
+
+
+
+Contract DSL
+
+
+
+
+
+
+
Contract DSL in Accurest is written in Groovy, but don’t be alarmed if you didn’t use Groovy before. Knowledge of the language is not really needed as our DSL uses only
+a tiny subset of it (namely literals, method calls and closures). What’s more, Accurest’s DSL is designed to be programmer-readable without any knowledge of the DSL itself -
+ it’s statically typed.
+
+
+
+
+
+
+
+
+Since {messaging_version} you can use the io.codearte.accurest.dsl.Accurest class in your DSL files.
+
+
+
+
+
+
Let’s look at full example of a contract definition.
Not all features of the DSL are used in example above. If you didn’t find what you are looking for, please check next paragraphs on this page.
+
+
+
+
+
You can easily compile Accurest Contracts to WireMock stubs mapping using standalone maven command: mvn io.codearte.accurest:accurest-maven-plugin:convert.
+
+
+
+
+
Limitations
+
+
+
+
+
+
+
+Accurest doesn’t support XML properly. Please use JSON or help us implement this feature.
+
+
+
+
+
+
+
+
+
+
+
+Accurest supports equality check on text response. Regular expressions are not yet available.
+
+
+
+
+
+
+
HTTP Top-Level Elements
+
+
Following methods can be called in the top-level closure of a contract definition. Request and response are mandatory, priority is optional.
+
+
+
+
io.codearte.accurest.dsl.GroovyDsl.make {
+ // Definition of HTTP request part of the contract
+ // (this can be a valid request or invalid depending
+ // on type of contract being specified).
+ request {
+ //...
+ }
+
+ // Definition of HTTP response part of the contract
+ // (a service implementing this contract should respond
+ // with following response after receiving request
+ // specified in "request" part above).
+ response {
+ //...
+ }
+
+ // Contract priority, which can be used for overriding
+ // contracts (1 is highest). Priority is optional.
+ priority 1
+}
+
+
+
+
+
Request
+
+
HTTP protocol requires only method and address to be specified in a request. The same information is mandatory in request definition of Accurest contract.
It is possible to specify whole url instead of just path, but urlPath is the recommended way as it makes the tests host-independent.
+
+
+
+
io.codearte.accurest.dsl.GroovyDsl.make {
+ request {
+ method 'GET'
+
+ // Specifying `url` and `urlPath` in one contract is illegal.
+ url('http://localhost:8888/users')
+ }
+
+ response {
+ //...
+ }
+}
+
+
+
+
Request may contain query parameters, which are specified in a closure nested in a call to urlPath or url.
+
+
+
+
io.codearte.accurest.dsl.GroovyDsl.make {
+ request {
+ //...
+
+ urlPath('/users') {
+
+ // Each parameter is specified in form
+ // `'paramName' : paramValue` where parameter value
+ // may be a simple literal or one of matcher functions,
+ // all of which are used in this example.
+ queryParameters {
+
+ // If a simple literal is used as value
+ // default matcher function is used (equalTo)
+ parameter 'limit': 100
+
+ // `equalTo` function simply compares passed value
+ // using identity operator (==).
+ parameter 'filter': equalTo("email")
+
+ // `containing` function matches strings
+ // that contains passed substring.
+ parameter 'gender': value(stub(containing("[mf]")), server('mf'))
+
+ // `matching` function tests parameter
+ // against passed regular expression.
+ parameter 'offset': value(stub(matching("[0-9]+")), server(123))
+
+ // `notMatching` functions tests if parameter
+ // does not match passed regular expression.
+ parameter 'loginStartsWith': value(stub(notMatching(".{0,2}")), server(3))
+ }
+ }
+
+ //...
+ }
+
+ response {
+ //...
+ }
+}
io.codearte.accurest.dsl.GroovyDsl.make {
+ request {
+ //...
+
+ // JSON and XML formats of request body are supported.
+ // Format will be determined from a header or body's content.
+ body '''{ "login" : "john", "name": "John The Contract" }'''
+ }
+
+ response {
+ //...
+ }
+}
+
+
+
+
Body’s format can also be specified explicitly by invoking one of format functions.
+
+
+
+
io.codearte.accurest.dsl.GroovyDsl.make {
+ request {
+ //...
+
+ // In this case body will be formatted as XML.
+ body equalToXml(
+ '''<user><login>john</login><name>John The Contract</name></user>'''
+ )
+ }
+
+ response {
+ //...
+ }
+}
+
+
+
+
+
Response
+
+
Minimal response must contain HTTP status code.
+
+
+
+
io.codearte.accurest.dsl.GroovyDsl.make {
+ request {
+ //...
+ }
+ response {
+ // Status code sent by the server
+ // in response to request specified above.
+ status 200
+ }
+}
+
+
+
+
Besides status response may contain headers and body, which are specified the same way as in the request (see previous paragraph).
+
+
+
+
Regular expressions
+
+
You can use regular expressions to write your requests in Contract DSL. It is particularly useful when you want to indicate that a given response
+should be provided for requests that follow a given pattern. Also, you can use it when you need to use patterns and not exact values both
+for your test and your server side tests.
It is also possible to define a method call to be executed on the server side during the test. Such a method can be added to the class defined as "baseClassForTests"
+in the configuration. Please see the examples below:
Starting with release 0.8.0 we support JAX-RS 2 Client API. Base class needs to define protected WebTarget webTarget and server initialization, right now the only option how to test JAX-RS API is to start a web server.
+
+
+
Request with a body needs to have a content type set otherwise application/octet-stream is going to be used.
+
+
+
In order to use JAX-RS mode, use the following settings:
The DSL for messaging looks a little bit different than the one that focuses on HTTP.
+
+
+
Output triggered by a method
+
+
The output message can be triggered by calling a method (e.g. a Scheduler was started and a message was sent)
+
+
+
+
def dsl = GroovyDsl.make {
+ // Human readable description
+ description 'Some description'
+ // Label by means of which the output message can be triggered
+ label 'some_label'
+ // input to the contract
+ input {
+ // the contract will be triggered by a method
+ triggeredBy('bookReturnedTriggered()')
+ }
+ // output message of the contract
+ outputMessage {
+ // destination to which the output message will be sent
+ sentTo('output')
+ // the body of the output message
+ body('''{ "bookName" : "foo" }''')
+ // the headers of the output message
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+}
+
+
+
+
In this case the output message will be sent to output if a method called bookReturnedTriggered will be executed. In the message publisher’s side
+we will generate a test that will call that method to trigger the message. On the consumer side you can use the some_label to trigger the message.
+
+
+
+
Output triggered by a message
+
+
The output message can be triggered by receiving a message.
+
+
+
+
def dsl = GroovyDsl.make {
+ description 'Some Description'
+ label 'some_label'
+ // input is a message
+ input {
+ // the message was received from this destination
+ messageFrom('input')
+ // has the following body
+ messageBody([
+ bookName: 'foo'
+ ])
+ // and the following headers
+ messageHeaders {
+ header('sample', 'header')
+ }
+ }
+ outputMessage {
+ sentTo('output')
+ body([
+ bookName: 'foo'
+ ])
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+}
+
+
+
+
In this case the output message will be sent to output if a proper message will be received on the input destination. In the message publisher’s side
+we will generate a test that will send the input message to the defined destination. On the consumer side you can either send a message to the input
+destination or use the some_label to trigger the message.
+
+
+
+
Consumer / Producer
+
+
In HTTP you have a notion of client/stub and `server/test notation. You can use them also in messaging but we’re providing also the consumer and produer methods
+as presented below (note you can use either $ or value methods to provide consumer and producer parts)
Adam Dudczak, Marcin Grzejszczak, Jakub Kubryński, Karol Lassak, Olga Maciaszek-Sharma, Mariusz Smykuła
+
+
+
+
+
Introduction
+
+
+
Just to make long story short - Accurest is a tool that enables Consumer Driven Contract (CDC) development of JVM-based applications. It is shipped
+with Contract Definition Language (DSL). Contract definitions are used by Accurest to produce following resources:
+
+
+
+
+
JSON stub definitions to be used by Wiremock when doing integration testing on the client code (client tests).
+Test code must still be written by hand, test data is produced by Accurest.
+
+
+
Messaging routes if you’re using one. We’re integrating with Spring Integration, Spring Cloud Stream and Apache Camel. You can however set your own integrations if you want to
+
+
+
Acceptance tests (in JUnit or Spock) used to verify if server-side implementation of the API is compliant with the contract (server tests). Full test is generated by Accurest.
+
+
+
+
+
Accurest moves TDD to the level of software architecture.
+
+
+
Why?
+
+
Let us assume that we have a system comprising of multiple microservices:
+
+
+
+
+
+
+
+
Testing issues
+
+
If we wanted to test the application in top left corner if it can communicate with other services then we could do one of two things:
+
+
+
+
+
deploy all microservices and perform end to end tests
+
+
+
mock other microservices in unit / integration tests
+
+
+
+
+
Both have their advantages but also a lot of disadvantages. Let’s focus on the latter.
+
+
+
Deploy all microservices and perform end to end tests
+
+
+
Advantages:
+
+
+
+
+
simulates production
+
+
+
tests real communication between services
+
+
+
+
+
Disadvantages:
+
+
+
+
+
to test one microservice we would have to deploy 6 microservices, a couple of databases etc.
+
+
+
the environment where the tests would be conducted would be locked for a single suite of tests (i.e. nobody else would be able to run the tests in the meantime).
+
+
+
long to run
+
+
+
very late feedback
+
+
+
extremely hard to debug
+
+
+
+
+
Mock other microservices in unit / integration tests
+
+
+
Advantages:
+
+
+
+
+
very fast feedback
+
+
+
no infrastructure requirements
+
+
+
+
+
Disadvantages:
+
+
+
+
+
the implementor of the service creates stubs thus they might have nothing to do with the reality
+
+
+
you can go to production with passing tests and failing production
+
+
+
+
+
To solve the aforementioned issues Accurest with Stub Runner were created. Their main idea is to give you very fast feedback, without the need
+to set up the whole world of microservices.
+
+
+
+
+
+
+
+
If you work on stubs then the only applications you need are those that your application is using directly.
+
+
+
+
+
+
+
+
Accurest gives you the certainty that the stubs that you’re using were created by the service that you’re calling. Also if you can use them it means that they were
+tested against the producer’s side. In other words - you can trust those stubs.
+
+
+
+
+
Purposes
+
+
The main purposes of Accurest with Stub Runner are:
+
+
+
+
+
to ensure that WireMock / Messaging stubs (used when developing the client) are doing exactly what actual server-side implementation will do,
+
+
+
to promote ATDD method and Microservices architectural style,
+
+
+
to provide a way to publish changes in contracts that are immediately visible on both sides,
+
+
+
to generate boilerplate test code used on the server side.
+
+
+
+
+
+
Client Side
+
+
During the tests you want to have a Wiremock instance / Messaging route up and running that simulates the service Y.
+You would like to feed that instance with a proper stub definition. That stub definition would need
+to be valid and should also be reusable on the server side.
+
+
+
Summing it up: On this side, in the stub definition, you can use patterns for request stubbing and you need exact
+values for responses.
+
+
+
+
Server Side
+
+
Being a service Y since you are developing your stub, you need to be sure that it’s actually resembling your
+concrete implementation. You can’t have a situation where your stub acts in one way and your application on
+production behaves in a different way.
+
+
+
That’s why from the provided stub acceptance tests will be generated that will ensure
+that your application behaves in the same way as you define in your stub.
+
+
+
Summing it up: On this side, in the stub definition, you need exact values as request and can use patterns/methods
+for response verification.
+
+
+
+
Dependencies
+
+
Accurest and Stub Runner are using the following libraries
Below you can find some resources related to Accurest and Stub Runner. Note that some can be outdated since the Accurest project
+is under constant development.
+
+
+
Videos
+
+
Olga Maciaszek-Sharma talking about Accurest
+
+
+
+
+
+
+
+
Marcin Grzejszczak and Jakub Kubryński talking about Accurest
Here you can find some working samples. Check the readme of each project for more information.
+
+
+
+
+
+
Contract DSL
+
+
+
Contract DSL in Accurest is written in Groovy, but don’t be alarmed if you didn’t use Groovy before. Knowledge of the language is not really needed as our DSL uses only
+a tiny subset of it (namely literals, method calls and closures). What’s more, Accurest’s DSL is designed to be programmer-readable without any knowledge of the DSL itself -
+ it’s statically typed.
+
+
+
+
+
+
+
+
+Since 1.1.0 you can use the io.codearte.accurest.dsl.Accurest class in your DSL files.
+
+
+
+
+
+
Let’s look at full example of a contract definition.
Not all features of the DSL are used in example above. If you didn’t find what you are looking for, please check next paragraphs on this page.
+
+
+
+
+
You can easily compile Accurest Contracts to WireMock stubs mapping using standalone maven command: mvn io.codearte.accurest:accurest-maven-plugin:convert.
+
+
+
+
+
Limitations
+
+
+
+
+
+
+
+Accurest doesn’t support XML properly. Please use JSON or help us implement this feature.
+
+
+
+
+
+
+
+
+
+
+
+Accurest supports equality check on text response. Regular expressions are not yet available.
+
+
+
+
+
+
+
HTTP Top-Level Elements
+
+
Following methods can be called in the top-level closure of a contract definition. Request and response are mandatory, priority is optional.
+
+
+
+
io.codearte.accurest.dsl.GroovyDsl.make {
+ // Definition of HTTP request part of the contract
+ // (this can be a valid request or invalid depending
+ // on type of contract being specified).
+ request {
+ //...
+ }
+
+ // Definition of HTTP response part of the contract
+ // (a service implementing this contract should respond
+ // with following response after receiving request
+ // specified in "request" part above).
+ response {
+ //...
+ }
+
+ // Contract priority, which can be used for overriding
+ // contracts (1 is highest). Priority is optional.
+ priority 1
+}
+
+
+
+
+
Request
+
+
HTTP protocol requires only method and address to be specified in a request. The same information is mandatory in request definition of Accurest contract.
It is possible to specify whole url instead of just path, but urlPath is the recommended way as it makes the tests host-independent.
+
+
+
+
io.codearte.accurest.dsl.GroovyDsl.make {
+ request {
+ method 'GET'
+
+ // Specifying `url` and `urlPath` in one contract is illegal.
+ url('http://localhost:8888/users')
+ }
+
+ response {
+ //...
+ }
+}
+
+
+
+
Request may contain query parameters, which are specified in a closure nested in a call to urlPath or url.
+
+
+
+
io.codearte.accurest.dsl.GroovyDsl.make {
+ request {
+ //...
+
+ urlPath('/users') {
+
+ // Each parameter is specified in form
+ // `'paramName' : paramValue` where parameter value
+ // may be a simple literal or one of matcher functions,
+ // all of which are used in this example.
+ queryParameters {
+
+ // If a simple literal is used as value
+ // default matcher function is used (equalTo)
+ parameter 'limit': 100
+
+ // `equalTo` function simply compares passed value
+ // using identity operator (==).
+ parameter 'filter': equalTo("email")
+
+ // `containing` function matches strings
+ // that contains passed substring.
+ parameter 'gender': value(stub(containing("[mf]")), server('mf'))
+
+ // `matching` function tests parameter
+ // against passed regular expression.
+ parameter 'offset': value(stub(matching("[0-9]+")), server(123))
+
+ // `notMatching` functions tests if parameter
+ // does not match passed regular expression.
+ parameter 'loginStartsWith': value(stub(notMatching(".{0,2}")), server(3))
+ }
+ }
+
+ //...
+ }
+
+ response {
+ //...
+ }
+}
io.codearte.accurest.dsl.GroovyDsl.make {
+ request {
+ //...
+
+ // JSON and XML formats of request body are supported.
+ // Format will be determined from a header or body's content.
+ body '''{ "login" : "john", "name": "John The Contract" }'''
+ }
+
+ response {
+ //...
+ }
+}
+
+
+
+
Body’s format can also be specified explicitly by invoking one of format functions.
+
+
+
+
io.codearte.accurest.dsl.GroovyDsl.make {
+ request {
+ //...
+
+ // In this case body will be formatted as XML.
+ body equalToXml(
+ '''<user><login>john</login><name>John The Contract</name></user>'''
+ )
+ }
+
+ response {
+ //...
+ }
+}
+
+
+
+
+
Response
+
+
Minimal response must contain HTTP status code.
+
+
+
+
io.codearte.accurest.dsl.GroovyDsl.make {
+ request {
+ //...
+ }
+ response {
+ // Status code sent by the server
+ // in response to request specified above.
+ status 200
+ }
+}
+
+
+
+
Besides status response may contain headers and body, which are specified the same way as in the request (see previous paragraph).
+
+
+
+
Regular expressions
+
+
You can use regular expressions to write your requests in Contract DSL. It is particularly useful when you want to indicate that a given response
+should be provided for requests that follow a given pattern. Also, you can use it when you need to use patterns and not exact values both
+for your test and your server side tests.
It is also possible to define a method call to be executed on the server side during the test. Such a method can be added to the class defined as "baseClassForTests"
+in the configuration. Please see the examples below:
Starting with release 0.8.0 we support JAX-RS 2 Client API. Base class needs to define protected WebTarget webTarget and server initialization, right now the only option how to test JAX-RS API is to start a web server.
+
+
+
Request with a body needs to have a content type set otherwise application/octet-stream is going to be used.
+
+
+
In order to use JAX-RS mode, use the following settings:
The DSL for messaging looks a little bit different than the one that focuses on HTTP.
+
+
+
Output triggered by a method
+
+
The output message can be triggered by calling a method (e.g. a Scheduler was started and a message was sent)
+
+
+
+
def dsl = GroovyDsl.make {
+ // Human readable description
+ description 'Some description'
+ // Label by means of which the output message can be triggered
+ label 'some_label'
+ // input to the contract
+ input {
+ // the contract will be triggered by a method
+ triggeredBy('bookReturnedTriggered()')
+ }
+ // output message of the contract
+ outputMessage {
+ // destination to which the output message will be sent
+ sentTo('output')
+ // the body of the output message
+ body('''{ "bookName" : "foo" }''')
+ // the headers of the output message
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+}
+
+
+
+
In this case the output message will be sent to output if a method called bookReturnedTriggered will be executed. In the message publisher’s side
+we will generate a test that will call that method to trigger the message. On the consumer side you can use the some_label to trigger the message.
+
+
+
+
Output triggered by a message
+
+
The output message can be triggered by receiving a message.
+
+
+
+
def dsl = GroovyDsl.make {
+ description 'Some Description'
+ label 'some_label'
+ // input is a message
+ input {
+ // the message was received from this destination
+ messageFrom('input')
+ // has the following body
+ messageBody([
+ bookName: 'foo'
+ ])
+ // and the following headers
+ messageHeaders {
+ header('sample', 'header')
+ }
+ }
+ outputMessage {
+ sentTo('output')
+ body([
+ bookName: 'foo'
+ ])
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+}
+
+
+
+
In this case the output message will be sent to output if a proper message will be received on the input destination. In the message publisher’s side
+we will generate a test that will send the input message to the defined destination. On the consumer side you can either send a message to the input
+destination or use the some_label to trigger the message.
+
+
+
+
Consumer / Producer
+
+
In HTTP you have a notion of client/stub and `server/test notation. You can use them also in messaging but we’re providing also the consumer and produer methods
+as presented below (note you can use either $ or value methods to provide consumer and producer parts)
By default Accurest is looking for stubs in src/test/resources/accurest directory.
+
+
+
Directory containing stub definitions is treated as a class name, and each stub definition is treated as a single test.
+We assume that it contains at least one directory which will be used as test class name. If there is more than one level of nested directories all except the last one will be used as package name.
+So with following structure
Accurest will create test class defaultBasePackage.MyService with two methods
+
+
+
+
+
shouldCreateUser()
+
+
+
shouldReturnUser()
+
+
+
+
+
+
+
Run plugin
+
+
Plugin registers itself to be invoked before check task. You have nothing to do as long as you want it to be part of your build process. If you just want to generate tests please invoke generateAccurest task.
+
+
+
+
Configure plugin
+
+
To change default configuration just add accurest snippet to your Gradle config
testMode - defines mode for acceptance tests. By default MockMvc which is based on Spring’s MockMvc. It can also be changed to JaxRsClient or to Explicit for real HTTP calls.
+
+
+
imports - array with imports that should be included in generated tests (for example ['org.myorg.Matchers']). By default empty array []
+
+
+
staticImports - array with static imports that should be included in generated tests(for example ['org.myorg.Matchers.*']). By default empty array []
+
+
+
basePackageForTests - specifies base package for all generated tests. By default set to io.codearte.accurest.tests
+
+
+
baseClassForTests - base class for generated tests. By default spock.lang.Specification if using Spock tests.
+
+
+
ruleClassForTests - specifies Rule which should be added to generated test classes.
+
+
+
ignoredFiles - Ant matcher allowing defining stub files for which processing should be skipped. By default empty array []
+
+
+
contractsDslDir - directory containing contracts written using the GroovyDSL. By default $rootDir/src/test/resources/accurest
+
+
+
generatedTestSourcesDir - test source directory where tests generated from Groovy DSL should be placed. By default $buildDir/generated-test-sources/accurest
+
+
+
stubsOutputDir - dir where the generated Wiremock stubs from Groovy DSL should be placed
+
+
+
targetFramework - the target test framework to be used; currently Spock and JUnit are supported with JUnit being the default framework
+
+
+
+
+
+
Base class for tests
+
+
When using Accurest in default MockMvc you need to create a base specification for all generated acceptance tests. In this class you need to point to endpoint which should be verified.
In case of using Explicit mode, you can use base class to initialize the whole tested app similarly as in regular integration tests. In case of JAXRSCLIENT mode this base class
+should also contain protected WebTarget webTarget field, right now the only option to test JAX-RS API is to start a web server.
+
+
+
+
+
Invoking generated tests
+
+
To ensure that provider side is complaint with defined contracts, you need to invoke:
+
+
+
+
./gradlew generateAccurest test
+
+
+
+
+
Accurest on consumer side
+
+
In consumer service you need to configure Accurest plugin in exactly the same way as in case of provider. If you don’t want to use Stub Runner then you need to copy contracts stored in
+src/test/resources/accurest and generate WireMock json stubs using:
+
+
+
+
./gradlew generateWireMockClientStubs
+
+
+
+
Note that stubsOutputDir option has to be set for stub generation to work.
+
+
+
When present, json stubs can be used in consumer automated tests.
Underneath LoanApplication makes a call to FraudDetection service. This request is handled by Wiremock server configured using stubs generated by Accurest.
By default Accurest is looking for stubs in src/test/resources/accurest directory.
+Directory containing stub definitions is treated as a class name, and each stub definition is treated as a single test.
+We assume that it contains at least one directory which will be used as test class name. If there is more than one level of nested directories all except the last one will be used as package name.
+So with following structure
Accurest will create test class defaultBasePackage.MyService with two methods
+ - shouldCreateUser()
+ - shouldReturnUser()
+
+
+
+
Run plugin
+
+
Plugin goal generateTests is assigned to be invoked in phase generate-test-sources. You have nothing to do as long as you want it to be part of your build process. If you just want to generate tests please invoke generateTests goal.
+
+
+
+
Configure plugin
+
+
To change default configuration just add configuration section to plugin definition or execution definition.
testMode - defines mode for acceptance tests. By default MockMvc which is based on Spring’s MockMvc. It can also be changed to JaxRsClient or to Explicit for real HTTP calls.
+
+
+
basePackageForTests - specifies base package for all generated tests. By default set to io.codearte.accurest.tests.
+
+
+
ruleClassForTests - specifies Rule which should be added to generated test classes.
+
+
+
baseClassForTests - base class for generated tests. By default spock.lang.Specification if using Spock tests.
+
+
+
contractsDir - directory containing contracts written using the GroovyDSL. By default /src/test/resources/accurest.
+
+
+
testFramework - the target test framework to be used; currently Spock and JUnit are supported with Spock being the default framework
When using Accurest in default MockMvc you need to create a base specification for all generated acceptance tests. In this class you need to point to endpoint which should be verified.
In case of using Explicit mode, you can use base class to initialize the whole tested app similarly as in regular integration tests. In case of JAXRSCLIENT mode this base class should also contain protected WebTarget webTarget field, right now the only option to test JAX-RS API is to start a web server.
+
+
+
+
+
Invoking generated tests
+
+
Accurest Maven Plugins generates verification code into directory /generated-test-sources/accurest and attach this directory to testCompile goal.
To ensure that provider side is complaint with defined contracts, you need to invoke mvn generateTest test
+
+
+
+
Accurest on consumer side
+
+
In consumer service you need to configure Accurest plugin in exactly the same way as in case of provider. You need to copy contracts stored in src/test/resources/accurest and generate Wiremock json stubs using: mvn generateStubs command. By default generated WireMock mapping is stored in directory target/mappings. Your project should create from this generated mappings additional artifact with classifier stubs for easy deploy to maven repository.
Underneath LoanApplication makes a call to FraudDetection service. This request is handled by Wiremock server configured using stubs generated by Accurest.
+
+
+
+
+
Scenarios
+
+
It’s possible to handle scenarios with Accurest. All you need to do is to stick to proper naming convention while creating your contracts. The convention requires to include order number followed by the underscore.
Such tree will cause Accurest generating Wiremock’s scenario with name scenario1 and three steps:
+ - login marked as Started pointing to:
+ - showCart marked as Step1 pointing to:
+ - logout marked as Step2 which will close the scenario.
+More details about Wiremock scenarios can be found under [http://wiremock.org/stateful-behaviour.html](http://wiremock.org/stateful-behaviour.html)
+
+
+
Accurest will also generate tests with guaranteed order of execution.
+
+
+
+
+
+
Accurest Messaging
+
+
+
+
+
+
+
+
+Feature available since 1.1.0
+
+
+
+
+
+
Accurest allows you to verify your application that uses messaging as means of communication.
+All of our integrations are working with Spring but you can also set one yourself.
+
+
+
Integrations
+
+
You can use one of the three integration configurations:
+
+
+
+
+
Apache Camel
+
+
+
Spring Integration
+
+
+
Spring Cloud Stream
+
+
+
+
+
If you’re using Spring Boot, the aforementioned test configurations will be appended automatically.
+
+
+
You have to provide as a dependency one of the Accurest Messaging modules. Example for Gradle:
+
+
+
+
// for Apache Camel
+testCompile "io.codearte.accurest:accurest-messaging-camel:${accurestVersion}"
+// for Spring Integration
+testCompile "io.codearte.accurest:accurest-messaging-integration:${accurestVersion}"
+// for Spring Cloud Stream
+testCompile "io.codearte.accurest:accurest-messaging-stream:${accurestVersion}"
+
+
+
+
+
Manual Integration
+
+
The accurest-messaging-core module contains 3 main interfaces:
+
+
+
+
+
AccurestMessage - describes a message received / sent to a channel / queue / topic etc.
+
+
+
AccurestMessageBuilder - describes how to build a message
+
+
+
AccurestMessaging - class that allows you to build, send and receive messages
+
+
+
AccurestFilter - interface to filter out the messages that do not follow the pattern from the DSL
+
+
+
+
+
In the generated test the AccurestMessaging is injected via @Inject annotation thus you can use other injection
+frameworks than Spring.
+
+
+
You have to provide as a dependency the accurest-messaging-core module. Example for Gradle:
Having the input or outputMessage sections in your DSL will result in creation of tests on the publisher’s side. By default
+JUnit tests will be created, however there is also a possibility to create Spock tests.
+
+
+
There are 3 main scenarios that we should take into consideration:
+
+
+
+
+
Scenario 1: there is no input message that produces an output one. The output message is triggered by a component
+inside the application (e.g. scheduler)
+
+
+
Scenario 2: the input message triggers an output message
+
+
+
Scenario 3: the input message is consumed and there is no output message
Unlike the HTTP part - in Messaging we need to publish the Groovy DSL inside the JAR with a stub. Then it’s parsed on the consumer side
+and proper stubbed routes are created.
+
+
+
For more infromation please consult the Stub Runner Messaging sections.
One of the issues that you could have encountered while using Accurest was to pass the generated WireMock JSON stubs from the server side to the client side (or various clients).
+ The same takes place in terms of client side generation for messaging.
+
+
+
Copying the JSON files / setting the client side for messaging manually is out of the question.
+
+
+
Publishing stubs as JARs
+
+
The easiest approach would be to centralize the way stubs are kept. For example you can keep them as JARs in a Maven repository.
Runs stubs for service collaborators. Treating stubs as contracts of services allows to use stub-runner as an implementation of
+Consumer Driven Contracts.
+
+
+
Stub Runner allows you to automatically download the stubs of the provided dependencies, start WireMock servers for them and feed them with proper stub definitions.
+For messaging, special stub routes are defined.
+
+
+
Running stubs
+
+
Running using main app
+
+
You can set the following options to the main class:
+
+
+
+
-maxp (--maxPort) N : Maximum port value to be assigned to the
+ Wiremock instance. Defaults to 15000
+ (default: 15000)
+-minp (--minPort) N : Minimal port value to be assigned to the
+ Wiremock instance. Defaults to 10000
+ (default: 10000)
+-s (--stubs) VAL : Comma separated list of Ivy representation of
+ jars with stubs. Eg. groupid:artifactid1,group
+ id2:artifactid2:version:classifier
+-sr (--stubRepositoryRoot) VAL : Location of a Jar containing server where you
+ keep your stubs (e.g. http://nexus.net/content
+ /repositories/repository)
+-ss (--stubsSuffix) VAL : Suffix for the jar containing stubs (e.g.
+ 'stubs'if the stub jar would have a 'stubs'
+ classifier forstubs: foobar-stubs ).
+ Defaults to 'stubs' (default: stubs)
+-wo (--workOffline) : Switch to work offline. Defaults to 'false'
+ (default: false)
Every stubbed collaborator exposes list of defined mappings under __/admin/ endpoint.
+
+
+
+
Messaging Stubs
+
+
Depending on the provided Stub Runner dependency and the DSL the messaging routes are automatically set up.
+
+
+
+
+
+
Stub Runner Boot
+
+
+
+
+
+
+
+Feature available since 1.1.0
+
+
+
+
+
+
Accurest Stub Runner Boot is a Spring Boot application that exposes REST endpoints to
+trigger the messaging labels and to access started WireMock servers.
// for Apache Camel
+compile "io.codearte.accurest:stub-runner-messaging-camel:${accurestVersion}"
+// for Spring Integration
+compile "io.codearte.accurest:stub-runner-messaging-integration:${accurestVersion}"
+// for Spring Cloud Stream
+compile "io.codearte.accurest:stub-runner-messaging-stream:${accurestVersion}"
+
+
+
+
Build a fat-jar and you’re ready to go!
+
+
+
For the properties check the Stub Runner Spring section.
+
+
+
+
Endpoints
+
+
HTTP
+
+
+
+
GET /stubs - returns a list of all running stubs in ivy:integer notation
+
+
+
GET /stubs/{ivy} - returns a port for the given ivy notation (when calling the endpoint ivy can also be artifactId only)
+
+
+
+
+
+
Messaging
+
+
For Messaging
+
+
+
+
+
GET /triggers - returns a list of all running labels in ivy : [ label1, label2 …] notation
+
+
+
POST /triggers/{label} - executes a trigger with label
+
+
+
POST /triggers/{ivy}/{label} - executes a trigger with label for the given ivy notation (when calling the endpoint ivy can also be artifactId only)
+
+
+
+
+
+
+
Example
+
+
+
@ContextConfiguration(classes = [StubRunnerBootSpec, StubRunnerBoot], loader = SpringApplicationContextLoader)
+@EnableBinding
+@Configuration
+classStubRunnerBootSpecextends Specification {
+
+ @Autowired StubRunning stubRunning
+
+ defsetup() {
+ RestAssuredMockMvc.standaloneSetup(new HttpStubsController(stubRunning),
+ new TriggerController(stubRunning))
+ }
+
+ def'should return a list of running stub servers in "full ivy:port" notation'() {
+ when:
+ String response = RestAssuredMockMvc.get('/stubs').body.asString()
+ then:
+ def root = new JsonSlurper().parseText(response)
+ root.'io.codearte.accurest.stubs:streamService:0.0.1-SNAPSHOT:stubs'instanceofInteger
+ }
+
+ def'should return a port on which a [#stubId] stub is running'() {
+ when:
+ def response = RestAssuredMockMvc.get("/stubs/${stubId}")
+ then:
+ response.statusCode == 200
+ response.body.as(Integer) > 0
+ where:
+ stubId << ['io.codearte.accurest.stubs:streamService:+:stubs',
+ 'io.codearte.accurest.stubs:streamService:0.0.1-SNAPSHOT:stubs',
+ 'io.codearte.accurest.stubs:streamService:+',
+ 'io.codearte.accurest.stubs:streamService',
+ 'streamService']
+ }
+
+ def'should return 404 when missing stub was called'() {
+ when:
+ def response = RestAssuredMockMvc.get("/stubs/a:b:c:d")
+ then:
+ response.statusCode == 404
+ }
+
+ def'should return a list of messaging labels that can be triggered when version and classifier are passed'() {
+ when:
+ String response = RestAssuredMockMvc.get('/triggers').body.asString()
+ then:
+ def root = new JsonSlurper().parseText(response)
+ root.'io.codearte.accurest.stubs:streamService:0.0.1-SNAPSHOT:stubs'?.containsAll(["delete_book","return_book_1","return_book_2"])
+ }
+
+ def'should trigger a messaging label'() {
+ given:
+ StubRunning stubRunning = Mock()
+ RestAssuredMockMvc.standaloneSetup(new HttpStubsController(stubRunning), new TriggerController(stubRunning))
+ when:
+ def response = RestAssuredMockMvc.post("/triggers/delete_book")
+ then:
+ response.statusCode == 200
+ and:
+ 1 * stubRunning.trigger('delete_book')
+ }
+
+ def'should trigger a messaging label for a stub with [#stubId] ivy notation'() {
+ given:
+ StubRunning stubRunning = Mock()
+ RestAssuredMockMvc.standaloneSetup(new HttpStubsController(stubRunning), new TriggerController(stubRunning))
+ when:
+ def response = RestAssuredMockMvc.post("/triggers/$stubId/delete_book")
+ then:
+ response.statusCode == 200
+ and:
+ 1 * stubRunning.trigger(stubId, 'delete_book')
+ where:
+ stubId << ['io.codearte.accurest.stubs:streamService:stubs', 'io.codearte.accurest.stubs:streamService', 'streamService']
+ }
+
+ def'should return when trigger is missing'() {
+ when:
+ def response = RestAssuredMockMvc.post("/triggers/missing_label")
+ then:
+ response.statusCode == 404
+ def root = new JsonSlurper().parseText(response.body.asString())
+ root.'io.codearte.accurest.stubs:streamService:0.0.1-SNAPSHOT:stubs'?.containsAll(["delete_book","return_book_1","return_book_2"])
+ }
+
+}
+
+
+
+
+
+
Stub Runner JUnit Rule
+
+
Stub Runner comes with a JUnit rule thanks to which you can very easily download and run stubs for given group and artifact id:
After that rule gets executed Stub Runner connects to your Maven repository and for the given list of dependencies tries to:
+
+
+
+
+
download them
+
+
+
cache them locally
+
+
+
unzip them to a temporary folder
+
+
+
start a WireMock server for each Maven dependency on a random port from the provided range of ports / provided port
+
+
+
feed the WireMock server with all JSON files that are valid WireMock definitions
+
+
+
+
+
Stub Runner uses Eclipse Aether mechanism to download the Maven dependencies.
+Check their docs for more information.
+
+
+
Since the AccurestRule implements the StubFinder it allows you to find the started stubs:
+
+
+
+
package io.codearte.accurest.stubrunner
+
+importio.codearte.accurest.dsl.GroovyDsl
+
+interface StubFinder extends StubTrigger {
+ /**
+ * For the given groupId and artifactId tries to find the matching
+ * URL of the running stub.
+ *
+ * @param groupId - might be null. In that case a search only via artifactId takes place
+ * @return URL of a running stub or null if not found
+ */
+ URL findStubUrl(String groupId, String artifactId)
+
+ /**
+ * For the given Ivy notation {@code groupId:artifactId} tries to find the matching
+ * URL of the running stub. You can also pass only {@code artifactId}.
+ *
+ * @param ivyNotation - Ivy representation of the Maven artifact
+ * @return URL of a running stub or null if not found
+ */
+ URL findStubUrl(String ivyNotation)
+
+ /**
+ * Returns all running stubs
+ */
+ RunningStubs findAllRunningStubs()
+
+ /**
+ * Returns the list of Accurest contracts
+ */
+ Map<StubConfiguration, Collection<GroovyDsl>> getAccurestContracts()
+}
Check the Common properties for JUnit and Spring for more information on how to apply global configuration of Stub Runner.
+
+
+
Providing fixed ports
+
+
You can also run your stubs on fixed ports. You can do it in two different ways. One is to pass it in the properties, and the other via fluent API of
+JUnit rule.
+
+
+
+
Fluent API
+
+
When using the AccurestRule you can add a stub to download and then pass the port for the last downloaded stub.
Registers the stubs in the provided Service Discovery. It’s enough to add the jar
+
+
+
+
io.codearte.accurest:stub-runner-spring-cloud
+
+
+
+
and the Stub Runner autoconfiguration should be picked up.
+
+
+
Stubbing Service Discovery
+
+
The most important feature of Stub Runner Spring Cloud is the fact that it’s stubbing
+
+
+
+
+
DiscoveryClient
+
+
+
RibbonServerList
+
+
+
+
+
that means that regardles of the fact whether you’re using Zookeeper, Consul, Eureka or anything else, you don’t need that in your tests.
+We’re starting WireMock instances of your dependencies and we’re telling your application whenever you’re using Feign, load balanced RestTemplate
+or DiscoveryClient directly, to call those stubbed servers instead of calling the real Service Discovery tool.
+
+
+
+
Additional Configuration
+
+
You can match the artifactId of the stub with the name of your app by using the stubrunner.stubs.idsToServiceIds: map.
+You can disable Stub Runner Ribbon support by providing: stubrunner.cloud.ribbon.enabled equal to false
+You can disable Stub Runner support by providing: stubrunner.cloud.enabled equal to false
+
+
+
+
+
Common properties for JUnit and Spring
+
+
Some of the properties that are repetitive can be set using system properties or property sources (for Spring). Here are their names with their default values:
+
+
+
+
+
+
+
+
+
+
Property name
+
Default value
+
Description
+
+
+
+
+
stubrunner.port.range.min
+
10000
+
Minimal value of a port for a started WireMock with stubs
+
+
+
stubrunner.port.range.max
+
15000
+
Minimal value of a port for a started WireMock with stubs
+
+
+
stubrunner.stubs.repository.root
+
+
Comma separated list of Maven repo urls. If blank then will call the local maven repo
+
+
+
stubrunner.stubs.classifier
+
stubs
+
Default classifier for the stub artifacts
+
+
+
stubrunner.work-offline
+
false
+
If true then will not contact any remote repositories to download stubs
+
+
+
stubrunner.stubs.ids
+
+
Comma separated list of Ivy notation of stubs to download
+
+
+
+
+
Stub runner stubs ids
+
+
You can provide the stubs to download via the stubrunner.stubs.ids system property. They follow the following pattern:
+
+
+
+
groupId:artifactId:version:classifier:port
+
+
+
+
version, classifier and port are optional.
+
+
+
+
+
If you don’t provide the port then a random one will be picked
+
+
+
If you don’t provide the classifier then the default one will be taken.
+
+
+
If you don’t provide the version then the + will be passed and the latest one will be downloaded
+
+
+
+
+
Where port means the port of the WireMock server.
+
+
+
+
+
+
+
Stub Runner for Messaging
+
+
+
+
+
+
+
+
+Feature available since 1.1.0
+
+
+
+
+
+
Stub Runner has the functionality to run the published stubs in memory. It can integrate with the following frameworks out of the box
+
+
+
+
+
Spring Integration
+
+
+
Spring Cloud Stream
+
+
+
Apache Camel
+
+
+
+
+
It also provides points of entry to integrate with any other solution on the market.
+
+
+
Stub triggering
+
+
To trigger a message it’s enough to use the StubTigger interface:
+
+
+
+
package io.codearte.accurest.stubrunner
+
+interface StubTrigger {
+
+ /**
+ * Triggers an event by a given label for a given {@code groupid:artifactid} notation. You can use only {@code artifactId} too.
+ *
+ * Feature related to messaging.
+ *
+ * @return true - if managed to run a trigger
+ */
+ boolean trigger(String ivyNotation, String labelName)
+
+ /**
+ * Triggers an event by a given label.
+ *
+ * Feature related to messaging.
+ *
+ * @return true - if managed to run a trigger
+ */
+ boolean trigger(String labelName)
+
+ /**
+ * Triggers all possible events.
+ *
+ * Feature related to messaging.
+ *
+ * @return true - if managed to run a trigger
+ */
+ boolean trigger()
+
+ /**
+ * Returns a mapping of ivy notation of a dependency to all the labels it has.
+ *
+ * Feature related to messaging.
+ */
+ Map<String, Collection<String>> labels()
+}
+
+
+
+
For convenience the StubFinder interface extends StubTrigger so it’s enough to use only one in your tests.
+
+
+
StubTrigger gives you the following options to trigger a message:
Accurest Stub Runner’s messaging module gives you an easy way to integrate with Apache Camel.
+For the provided artifacts it will automatically download the stubs and register the required
+routes.
+
+
+
Adding it to the project
+
+
To use it you have to add the following dependency to your project (example for Gradle):
Since the route is set for you it’s enough to just send a message to the jms:output destination.
+
+
+
+
camelContext.createProducerTemplate().sendBodyAndHeaders('jms:delete', new BookReturned('foo'), [sample: 'header'])
+
+
+
+
+
+
+
Stub Runner Messaging Integration
+
+
Accurest Stub Runner’s messaging module gives you an easy way to integrate with Spring Integration.
+For the provided artifacts it will automatically download the stubs and register the required
+routes.
+
+
+
Adding it to the project
+
+
To use it you have to add the following dependency to your project (example for Gradle):
Accurest Stub Runner’s messaging module gives you an easy way to integrate with Spring Stream.
+For the provided artifacts it will automatically download the stubs and register the required
+routes.
+
+
+
+
+
+
+
+
+In Stub Runner’s integration with Stream the messageFrom or sentTo Strings are resolved
+first as a destination of a channel, and then if there is no such destination it’s resolved as a
+channel name.
+
+
+
+
+
+
Adding it to the project
+
+
To use it you have to add the following dependency to your project (example for Gradle):
in 0.4.7 we’ve fixed package name (coderate to codearte) so you’ve to do the same in your projects. This means replacing io.coderate.accurest.dsl.GroovyDsl with io.codearte.accurest.dsl.GroovyDsl
+
+
+
+
+
+
Migration to 1.0.0-RC1
+
+
+
+
from 1.0.0 we’re distinguish ignored contracts from excluded contracts:
+
+
+
excludedFiles pattern tells Accurest to skip processing those files at all
+
+
+
ignoredFiles pattern tells Accurest to generate contracts and tests, but tests will be marked as @Ignore
+
+
+
from 1.0.0 the basePackageForTests behaviour has changed
+
+
+
prior to the change all DSL files had to be under contractsDslDir/basePackageForTests/subpackage resulting in basePackageForTests.subpackage test package creation
+
+
+
now all DSL files have to be under contractsDslDir/subpackage resulting in basePackageForTests.subpackage test package creation
+
+
+
If you don’t migrate to the new approach you will have your tests under contractsDslDir.contractsDslDir.subpackage
+
+
+
+
+
+
Migration to 1.1.0
+
+
+
+
from 1.1.0 we’re setting JUnit as a default testing utility. You have to pass the following option to keep Spock
+as your first choice:
+
+
+
+
+
+
targetFramework = 'Spock'
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/introduction.html b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/introduction.html
new file mode 100644
index 0000000000..5f173f30de
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/introduction.html
@@ -0,0 +1,797 @@
+
+
+
+
+
+
+
+Introduction
+
+
+
+
+
+
+
Just to make long story short - Accurest is a tool that enables Consumer Driven Contract (CDC) development of JVM-based applications. It is shipped
+with Contract Definition Language (DSL). Contract definitions are used by Accurest to produce following resources:
+
+
+
+
+
JSON stub definitions to be used by Wiremock when doing integration testing on the client code (client tests).
+Test code must still be written by hand, test data is produced by Accurest.
+
+
+
Messaging routes if you’re using one. We’re integrating with Spring Integration, Spring Cloud Stream and Apache Camel. You can however set your own integrations if you want to
+
+
+
Acceptance tests (in JUnit or Spock) used to verify if server-side implementation of the API is compliant with the contract (server tests). Full test is generated by Accurest.
+
+
+
+
+
Accurest moves TDD to the level of software architecture.
+
+
+
Why?
+
+
Let us assume that we have a system comprising of multiple microservices:
+
+
+
+
+
+
+
+
Testing issues
+
+
If we wanted to test the application in top left corner if it can communicate with other services then we could do one of two things:
+
+
+
+
+
deploy all microservices and perform end to end tests
+
+
+
mock other microservices in unit / integration tests
+
+
+
+
+
Both have their advantages but also a lot of disadvantages. Let’s focus on the latter.
+
+
+
Deploy all microservices and perform end to end tests
+
+
+
Advantages:
+
+
+
+
+
simulates production
+
+
+
tests real communication between services
+
+
+
+
+
Disadvantages:
+
+
+
+
+
to test one microservice we would have to deploy 6 microservices, a couple of databases etc.
+
+
+
the environment where the tests would be conducted would be locked for a single suite of tests (i.e. nobody else would be able to run the tests in the meantime).
+
+
+
long to run
+
+
+
very late feedback
+
+
+
extremely hard to debug
+
+
+
+
+
Mock other microservices in unit / integration tests
+
+
+
Advantages:
+
+
+
+
+
very fast feedback
+
+
+
no infrastructure requirements
+
+
+
+
+
Disadvantages:
+
+
+
+
+
the implementor of the service creates stubs thus they might have nothing to do with the reality
+
+
+
you can go to production with passing tests and failing production
+
+
+
+
+
To solve the aforementioned issues Accurest with Stub Runner were created. Their main idea is to give you very fast feedback, without the need
+to set up the whole world of microservices.
+
+
+
+
+
+
+
+
If you work on stubs then the only applications you need are those that your application is using directly.
+
+
+
+
+
+
+
+
Accurest gives you the certainty that the stubs that you’re using were created by the service that you’re calling. Also if you can use them it means that they were
+tested against the producer’s side. In other words - you can trust those stubs.
+
+
+
+
+
Purposes
+
+
The main purposes of Accurest with Stub Runner are:
+
+
+
+
+
to ensure that WireMock / Messaging stubs (used when developing the client) are doing exactly what actual server-side implementation will do,
+
+
+
to promote ATDD method and Microservices architectural style,
+
+
+
to provide a way to publish changes in contracts that are immediately visible on both sides,
+
+
+
to generate boilerplate test code used on the server side.
+
+
+
+
+
+
Client Side
+
+
During the tests you want to have a Wiremock instance / Messaging route up and running that simulates the service Y.
+You would like to feed that instance with a proper stub definition. That stub definition would need
+to be valid and should also be reusable on the server side.
+
+
+
Summing it up: On this side, in the stub definition, you can use patterns for request stubbing and you need exact
+values for responses.
+
+
+
+
Server Side
+
+
Being a service Y since you are developing your stub, you need to be sure that it’s actually resembling your
+concrete implementation. You can’t have a situation where your stub acts in one way and your application on
+production behaves in a different way.
+
+
+
That’s why from the provided stub acceptance tests will be generated that will ensure
+that your application behaves in the same way as you define in your stub.
+
+
+
Summing it up: On this side, in the stub definition, you need exact values as request and can use patterns/methods
+for response verification.
+
+
+
+
Dependencies
+
+
Accurest and Stub Runner are using the following libraries
Below you can find some resources related to Accurest and Stub Runner. Note that some can be outdated since the Accurest project
+is under constant development.
+
+
+
Videos
+
+
Olga Maciaszek-Sharma talking about Accurest
+
+
+
+
+
+
+
+
Marcin Grzejszczak and Jakub Kubryński talking about Accurest
Accurest allows you to verify your application that uses messaging as means of communication.
+All of our integrations are working with Spring but you can also set one yourself.
+
+
+
Integrations
+
+
You can use one of the three integration configurations:
+
+
+
+
+
Apache Camel
+
+
+
Spring Integration
+
+
+
Spring Cloud Stream
+
+
+
+
+
If you’re using Spring Boot, the aforementioned test configurations will be appended automatically.
+
+
+
You have to provide as a dependency one of the Accurest Messaging modules. Example for Gradle:
+
+
+
+
// for Apache Camel
+testCompile "io.codearte.accurest:accurest-messaging-camel:${accurestVersion}"
+// for Spring Integration
+testCompile "io.codearte.accurest:accurest-messaging-integration:${accurestVersion}"
+// for Spring Cloud Stream
+testCompile "io.codearte.accurest:accurest-messaging-stream:${accurestVersion}"
+
+
+
+
+
Manual Integration
+
+
The accurest-messaging-core module contains 3 main interfaces:
+
+
+
+
+
AccurestMessage - describes a message received / sent to a channel / queue / topic etc.
+
+
+
AccurestMessageBuilder - describes how to build a message
+
+
+
AccurestMessaging - class that allows you to build, send and receive messages
+
+
+
AccurestFilter - interface to filter out the messages that do not follow the pattern from the DSL
+
+
+
+
+
In the generated test the AccurestMessaging is injected via @Inject annotation thus you can use other injection
+frameworks than Spring.
+
+
+
You have to provide as a dependency the accurest-messaging-core module. Example for Gradle:
Having the input or outputMessage sections in your DSL will result in creation of tests on the publisher’s side. By default
+JUnit tests will be created, however there is also a possibility to create Spock tests.
+
+
+
There are 3 main scenarios that we should take into consideration:
+
+
+
+
+
Scenario 1: there is no input message that produces an output one. The output message is triggered by a component
+inside the application (e.g. scheduler)
+
+
+
Scenario 2: the input message triggers an output message
+
+
+
Scenario 3: the input message is consumed and there is no output message
Unlike the HTTP part - in Messaging we need to publish the Groovy DSL inside the JAR with a stub. Then it’s parsed on the consumer side
+and proper stubbed routes are created.
+
+
+
For more infromation please consult the Stub Runner Messaging sections.
in 0.4.7 we’ve fixed package name (coderate to codearte) so you’ve to do the same in your projects. This means replacing io.coderate.accurest.dsl.GroovyDsl with io.codearte.accurest.dsl.GroovyDsl
+
+
+
+
+
+
Migration to 1.0.0-RC1
+
+
+
+
from 1.0.0 we’re distinguish ignored contracts from excluded contracts:
+
+
+
excludedFiles pattern tells Accurest to skip processing those files at all
+
+
+
ignoredFiles pattern tells Accurest to generate contracts and tests, but tests will be marked as @Ignore
+
+
+
from 1.0.0 the basePackageForTests behaviour has changed
+
+
+
prior to the change all DSL files had to be under contractsDslDir/basePackageForTests/subpackage resulting in basePackageForTests.subpackage test package creation
+
+
+
now all DSL files have to be under contractsDslDir/subpackage resulting in basePackageForTests.subpackage test package creation
+
+
+
If you don’t migrate to the new approach you will have your tests under contractsDslDir.contractsDslDir.subpackage
+
+
+
+
+
+
Migration to {messaging_version}
+
+
+
+
from {messaging_version} we’re setting JUnit as a default testing utility. You have to pass the following option to keep Spock
+as your first choice:
+
+
+
+
+
+
targetFramework = 'Spock'
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/rest.html b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/rest.html
new file mode 100644
index 0000000000..bab2a70944
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/rest.html
@@ -0,0 +1,1032 @@
+
+
+
+
+
+
+
+Accurest HTTP
+
+
+
+
+
+
+
By default Accurest is looking for stubs in src/test/resources/accurest directory.
+
+
+
Directory containing stub definitions is treated as a class name, and each stub definition is treated as a single test.
+We assume that it contains at least one directory which will be used as test class name. If there is more than one level of nested directories all except the last one will be used as package name.
+So with following structure
Accurest will create test class defaultBasePackage.MyService with two methods
+
+
+
+
+
shouldCreateUser()
+
+
+
shouldReturnUser()
+
+
+
+
+
+
+
Run plugin
+
+
Plugin registers itself to be invoked before check task. You have nothing to do as long as you want it to be part of your build process. If you just want to generate tests please invoke generateAccurest task.
+
+
+
+
Configure plugin
+
+
To change default configuration just add accurest snippet to your Gradle config
testMode - defines mode for acceptance tests. By default MockMvc which is based on Spring’s MockMvc. It can also be changed to JaxRsClient or to Explicit for real HTTP calls.
+
+
+
imports - array with imports that should be included in generated tests (for example ['org.myorg.Matchers']). By default empty array []
+
+
+
staticImports - array with static imports that should be included in generated tests(for example ['org.myorg.Matchers.*']). By default empty array []
+
+
+
basePackageForTests - specifies base package for all generated tests. By default set to io.codearte.accurest.tests
+
+
+
baseClassForTests - base class for generated tests. By default spock.lang.Specification if using Spock tests.
+
+
+
ruleClassForTests - specifies Rule which should be added to generated test classes.
+
+
+
ignoredFiles - Ant matcher allowing defining stub files for which processing should be skipped. By default empty array []
+
+
+
contractsDslDir - directory containing contracts written using the GroovyDSL. By default $rootDir/src/test/resources/accurest
+
+
+
generatedTestSourcesDir - test source directory where tests generated from Groovy DSL should be placed. By default $buildDir/generated-test-sources/accurest
+
+
+
stubsOutputDir - dir where the generated Wiremock stubs from Groovy DSL should be placed
+
+
+
targetFramework - the target test framework to be used; currently Spock and JUnit are supported with JUnit being the default framework
+
+
+
+
+
+
Base class for tests
+
+
When using Accurest in default MockMvc you need to create a base specification for all generated acceptance tests. In this class you need to point to endpoint which should be verified.
In case of using Explicit mode, you can use base class to initialize the whole tested app similarly as in regular integration tests. In case of JAXRSCLIENT mode this base class
+should also contain protected WebTarget webTarget field, right now the only option to test JAX-RS API is to start a web server.
+
+
+
+
+
Invoking generated tests
+
+
To ensure that provider side is complaint with defined contracts, you need to invoke:
+
+
+
+
./gradlew generateAccurest test
+
+
+
+
+
Accurest on consumer side
+
+
In consumer service you need to configure Accurest plugin in exactly the same way as in case of provider. If you don’t want to use Stub Runner then you need to copy contracts stored in
+src/test/resources/accurest and generate WireMock json stubs using:
+
+
+
+
./gradlew generateWireMockClientStubs
+
+
+
+
Note that stubsOutputDir option has to be set for stub generation to work.
+
+
+
When present, json stubs can be used in consumer automated tests.
Underneath LoanApplication makes a call to FraudDetection service. This request is handled by Wiremock server configured using stubs generated by Accurest.
By default Accurest is looking for stubs in src/test/resources/accurest directory.
+Directory containing stub definitions is treated as a class name, and each stub definition is treated as a single test.
+We assume that it contains at least one directory which will be used as test class name. If there is more than one level of nested directories all except the last one will be used as package name.
+So with following structure
Accurest will create test class defaultBasePackage.MyService with two methods
+ - shouldCreateUser()
+ - shouldReturnUser()
+
+
+
+
Run plugin
+
+
Plugin goal generateTests is assigned to be invoked in phase generate-test-sources. You have nothing to do as long as you want it to be part of your build process. If you just want to generate tests please invoke generateTests goal.
+
+
+
+
Configure plugin
+
+
To change default configuration just add configuration section to plugin definition or execution definition.
testMode - defines mode for acceptance tests. By default MockMvc which is based on Spring’s MockMvc. It can also be changed to JaxRsClient or to Explicit for real HTTP calls.
+
+
+
basePackageForTests - specifies base package for all generated tests. By default set to io.codearte.accurest.tests.
+
+
+
ruleClassForTests - specifies Rule which should be added to generated test classes.
+
+
+
baseClassForTests - base class for generated tests. By default spock.lang.Specification if using Spock tests.
+
+
+
contractsDir - directory containing contracts written using the GroovyDSL. By default /src/test/resources/accurest.
+
+
+
testFramework - the target test framework to be used; currently Spock and JUnit are supported with Spock being the default framework
When using Accurest in default MockMvc you need to create a base specification for all generated acceptance tests. In this class you need to point to endpoint which should be verified.
In case of using Explicit mode, you can use base class to initialize the whole tested app similarly as in regular integration tests. In case of JAXRSCLIENT mode this base class should also contain protected WebTarget webTarget field, right now the only option to test JAX-RS API is to start a web server.
+
+
+
+
+
Invoking generated tests
+
+
Accurest Maven Plugins generates verification code into directory /generated-test-sources/accurest and attach this directory to testCompile goal.
To ensure that provider side is complaint with defined contracts, you need to invoke mvn generateTest test
+
+
+
+
Accurest on consumer side
+
+
In consumer service you need to configure Accurest plugin in exactly the same way as in case of provider. You need to copy contracts stored in src/test/resources/accurest and generate Wiremock json stubs using: mvn generateStubs command. By default generated WireMock mapping is stored in directory target/mappings. Your project should create from this generated mappings additional artifact with classifier stubs for easy deploy to maven repository.
Underneath LoanApplication makes a call to FraudDetection service. This request is handled by Wiremock server configured using stubs generated by Accurest.
+
+
+
+
+
Scenarios
+
+
It’s possible to handle scenarios with Accurest. All you need to do is to stick to proper naming convention while creating your contracts. The convention requires to include order number followed by the underscore.
Such tree will cause Accurest generating Wiremock’s scenario with name scenario1 and three steps:
+ - login marked as Started pointing to:
+ - showCart marked as Step1 pointing to:
+ - logout marked as Step2 which will close the scenario.
+More details about Wiremock scenarios can be found under [http://wiremock.org/stateful-behaviour.html](http://wiremock.org/stateful-behaviour.html)
+
+
+
Accurest will also generate tests with guaranteed order of execution.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/stubrunner.html b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/stubrunner.html
new file mode 100644
index 0000000000..901a8fd60f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/stubrunner.html
@@ -0,0 +1,1258 @@
+
+
+
+
+
+
+
+Stub Runner
+
+
+
+
+
+
+
One of the issues that you could have encountered while using Accurest was to pass the generated WireMock JSON stubs from the server side to the client side (or various clients).
+ The same takes place in terms of client side generation for messaging.
+
+
+
Copying the JSON files / setting the client side for messaging manually is out of the question.
+
+
+
Publishing stubs as JARs
+
+
The easiest approach would be to centralize the way stubs are kept. For example you can keep them as JARs in a Maven repository.
Runs stubs for service collaborators. Treating stubs as contracts of services allows to use stub-runner as an implementation of
+Consumer Driven Contracts.
+
+
+
Stub Runner allows you to automatically download the stubs of the provided dependencies, start WireMock servers for them and feed them with proper stub definitions.
+For messaging, special stub routes are defined.
+
+
+
Running stubs
+
+
Running using main app
+
+
You can set the following options to the main class:
+
+
+
+
-maxp (--maxPort) N : Maximum port value to be assigned to the
+ Wiremock instance. Defaults to 15000
+ (default: 15000)
+-minp (--minPort) N : Minimal port value to be assigned to the
+ Wiremock instance. Defaults to 10000
+ (default: 10000)
+-s (--stubs) VAL : Comma separated list of Ivy representation of
+ jars with stubs. Eg. groupid:artifactid1,group
+ id2:artifactid2:version:classifier
+-sr (--stubRepositoryRoot) VAL : Location of a Jar containing server where you
+ keep your stubs (e.g. http://nexus.net/content
+ /repositories/repository)
+-ss (--stubsSuffix) VAL : Suffix for the jar containing stubs (e.g.
+ 'stubs'if the stub jar would have a 'stubs'
+ classifier forstubs: foobar-stubs ).
+ Defaults to 'stubs' (default: stubs)
+-wo (--workOffline) : Switch to work offline. Defaults to 'false'
+ (default: false)
Every stubbed collaborator exposes list of defined mappings under __/admin/ endpoint.
+
+
+
+
Messaging Stubs
+
+
Depending on the provided Stub Runner dependency and the DSL the messaging routes are automatically set up.
+
+
+
+
+
+
Stub Runner Boot
+
+
+
+
+
+
+
+Feature available since {messaging_version}
+
+
+
+
+
+
Accurest Stub Runner Boot is a Spring Boot application that exposes REST endpoints to
+trigger the messaging labels and to access started WireMock servers.
// for Apache Camel
+compile "io.codearte.accurest:stub-runner-messaging-camel:${accurestVersion}"
+// for Spring Integration
+compile "io.codearte.accurest:stub-runner-messaging-integration:${accurestVersion}"
+// for Spring Cloud Stream
+compile "io.codearte.accurest:stub-runner-messaging-stream:${accurestVersion}"
+
+
+
+
Build a fat-jar and you’re ready to go!
+
+
+
For the properties check the Stub Runner Spring section.
+
+
+
+
Endpoints
+
+
HTTP
+
+
+
+
GET /stubs - returns a list of all running stubs in ivy:integer notation
+
+
+
GET /stubs/{ivy} - returns a port for the given ivy notation (when calling the endpoint ivy can also be artifactId only)
+
+
+
+
+
+
Messaging
+
+
For Messaging
+
+
+
+
+
GET /triggers - returns a list of all running labels in ivy : [ label1, label2 …] notation
+
+
+
POST /triggers/{label} - executes a trigger with label
+
+
+
POST /triggers/{ivy}/{label} - executes a trigger with label for the given ivy notation (when calling the endpoint ivy can also be artifactId only)
+
+
+
+
+
+
+
Example
+
+
+
@ContextConfiguration(classes = [StubRunnerBootSpec, StubRunnerBoot], loader = SpringApplicationContextLoader)
+@EnableBinding
+@Configuration
+classStubRunnerBootSpecextends Specification {
+
+ @Autowired StubRunning stubRunning
+
+ defsetup() {
+ RestAssuredMockMvc.standaloneSetup(new HttpStubsController(stubRunning),
+ new TriggerController(stubRunning))
+ }
+
+ def'should return a list of running stub servers in "full ivy:port" notation'() {
+ when:
+ String response = RestAssuredMockMvc.get('/stubs').body.asString()
+ then:
+ def root = new JsonSlurper().parseText(response)
+ root.'io.codearte.accurest.stubs:streamService:0.0.1-SNAPSHOT:stubs'instanceofInteger
+ }
+
+ def'should return a port on which a [#stubId] stub is running'() {
+ when:
+ def response = RestAssuredMockMvc.get("/stubs/${stubId}")
+ then:
+ response.statusCode == 200
+ response.body.as(Integer) > 0
+ where:
+ stubId << ['io.codearte.accurest.stubs:streamService:+:stubs',
+ 'io.codearte.accurest.stubs:streamService:0.0.1-SNAPSHOT:stubs',
+ 'io.codearte.accurest.stubs:streamService:+',
+ 'io.codearte.accurest.stubs:streamService',
+ 'streamService']
+ }
+
+ def'should return 404 when missing stub was called'() {
+ when:
+ def response = RestAssuredMockMvc.get("/stubs/a:b:c:d")
+ then:
+ response.statusCode == 404
+ }
+
+ def'should return a list of messaging labels that can be triggered when version and classifier are passed'() {
+ when:
+ String response = RestAssuredMockMvc.get('/triggers').body.asString()
+ then:
+ def root = new JsonSlurper().parseText(response)
+ root.'io.codearte.accurest.stubs:streamService:0.0.1-SNAPSHOT:stubs'?.containsAll(["delete_book","return_book_1","return_book_2"])
+ }
+
+ def'should trigger a messaging label'() {
+ given:
+ StubRunning stubRunning = Mock()
+ RestAssuredMockMvc.standaloneSetup(new HttpStubsController(stubRunning), new TriggerController(stubRunning))
+ when:
+ def response = RestAssuredMockMvc.post("/triggers/delete_book")
+ then:
+ response.statusCode == 200
+ and:
+ 1 * stubRunning.trigger('delete_book')
+ }
+
+ def'should trigger a messaging label for a stub with [#stubId] ivy notation'() {
+ given:
+ StubRunning stubRunning = Mock()
+ RestAssuredMockMvc.standaloneSetup(new HttpStubsController(stubRunning), new TriggerController(stubRunning))
+ when:
+ def response = RestAssuredMockMvc.post("/triggers/$stubId/delete_book")
+ then:
+ response.statusCode == 200
+ and:
+ 1 * stubRunning.trigger(stubId, 'delete_book')
+ where:
+ stubId << ['io.codearte.accurest.stubs:streamService:stubs', 'io.codearte.accurest.stubs:streamService', 'streamService']
+ }
+
+ def'should return when trigger is missing'() {
+ when:
+ def response = RestAssuredMockMvc.post("/triggers/missing_label")
+ then:
+ response.statusCode == 404
+ def root = new JsonSlurper().parseText(response.body.asString())
+ root.'io.codearte.accurest.stubs:streamService:0.0.1-SNAPSHOT:stubs'?.containsAll(["delete_book","return_book_1","return_book_2"])
+ }
+
+}
+
+
+
+
+
+
Stub Runner JUnit Rule
+
+
Stub Runner comes with a JUnit rule thanks to which you can very easily download and run stubs for given group and artifact id:
After that rule gets executed Stub Runner connects to your Maven repository and for the given list of dependencies tries to:
+
+
+
+
+
download them
+
+
+
cache them locally
+
+
+
unzip them to a temporary folder
+
+
+
start a WireMock server for each Maven dependency on a random port from the provided range of ports / provided port
+
+
+
feed the WireMock server with all JSON files that are valid WireMock definitions
+
+
+
+
+
Stub Runner uses Eclipse Aether mechanism to download the Maven dependencies.
+Check their docs for more information.
+
+
+
Since the AccurestRule implements the StubFinder it allows you to find the started stubs:
+
+
+
+
package io.codearte.accurest.stubrunner
+
+importio.codearte.accurest.dsl.GroovyDsl
+
+interface StubFinder extends StubTrigger {
+ /**
+ * For the given groupId and artifactId tries to find the matching
+ * URL of the running stub.
+ *
+ * @param groupId - might be null. In that case a search only via artifactId takes place
+ * @return URL of a running stub or null if not found
+ */
+ URL findStubUrl(String groupId, String artifactId)
+
+ /**
+ * For the given Ivy notation {@code groupId:artifactId} tries to find the matching
+ * URL of the running stub. You can also pass only {@code artifactId}.
+ *
+ * @param ivyNotation - Ivy representation of the Maven artifact
+ * @return URL of a running stub or null if not found
+ */
+ URL findStubUrl(String ivyNotation)
+
+ /**
+ * Returns all running stubs
+ */
+ RunningStubs findAllRunningStubs()
+
+ /**
+ * Returns the list of Accurest contracts
+ */
+ Map<StubConfiguration, Collection<GroovyDsl>> getAccurestContracts()
+}
Check the Common properties for JUnit and Spring for more information on how to apply global configuration of Stub Runner.
+
+
+
Providing fixed ports
+
+
You can also run your stubs on fixed ports. You can do it in two different ways. One is to pass it in the properties, and the other via fluent API of
+JUnit rule.
+
+
+
+
Fluent API
+
+
When using the AccurestRule you can add a stub to download and then pass the port for the last downloaded stub.
Registers the stubs in the provided Service Discovery. It’s enough to add the jar
+
+
+
+
io.codearte.accurest:stub-runner-spring-cloud
+
+
+
+
and the Stub Runner autoconfiguration should be picked up.
+
+
+
Stubbing Service Discovery
+
+
The most important feature of Stub Runner Spring Cloud is the fact that it’s stubbing
+
+
+
+
+
DiscoveryClient
+
+
+
RibbonServerList
+
+
+
+
+
that means that regardles of the fact whether you’re using Zookeeper, Consul, Eureka or anything else, you don’t need that in your tests.
+We’re starting WireMock instances of your dependencies and we’re telling your application whenever you’re using Feign, load balanced RestTemplate
+or DiscoveryClient directly, to call those stubbed servers instead of calling the real Service Discovery tool.
+
+
+
+
Additional Configuration
+
+
You can match the artifactId of the stub with the name of your app by using the stubrunner.stubs.idsToServiceIds: map.
+You can disable Stub Runner Ribbon support by providing: stubrunner.cloud.ribbon.enabled equal to false
+You can disable Stub Runner support by providing: stubrunner.cloud.enabled equal to false
+
+
+
+
+
Common properties for JUnit and Spring
+
+
Some of the properties that are repetitive can be set using system properties or property sources (for Spring). Here are their names with their default values:
+
+
+
+
+
+
+
+
+
+
Property name
+
Default value
+
Description
+
+
+
+
+
stubrunner.port.range.min
+
10000
+
Minimal value of a port for a started WireMock with stubs
+
+
+
stubrunner.port.range.max
+
15000
+
Minimal value of a port for a started WireMock with stubs
+
+
+
stubrunner.stubs.repository.root
+
+
Comma separated list of Maven repo urls. If blank then will call the local maven repo
+
+
+
stubrunner.stubs.classifier
+
stubs
+
Default classifier for the stub artifacts
+
+
+
stubrunner.work-offline
+
false
+
If true then will not contact any remote repositories to download stubs
+
+
+
stubrunner.stubs.ids
+
+
Comma separated list of Ivy notation of stubs to download
+
+
+
+
+
Stub runner stubs ids
+
+
You can provide the stubs to download via the stubrunner.stubs.ids system property. They follow the following pattern:
+
+
+
+
groupId:artifactId:version:classifier:port
+
+
+
+
version, classifier and port are optional.
+
+
+
+
+
If you don’t provide the port then a random one will be picked
+
+
+
If you don’t provide the classifier then the default one will be taken.
+
+
+
If you don’t provide the version then the + will be passed and the latest one will be downloaded
+
+
+
+
+
Where port means the port of the WireMock server.
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/stubrunner_msg.html b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/stubrunner_msg.html
new file mode 100644
index 0000000000..ae7b656eea
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/deprecated/stubrunner_msg.html
@@ -0,0 +1,1247 @@
+
+
+
+
+
+
+
+Stub Runner for Messaging
+
+
+
+
+
+
+
Stub Runner has the functionality to run the published stubs in memory. It can integrate with the following frameworks out of the box
+
+
+
+
+
Spring Integration
+
+
+
Spring Cloud Stream
+
+
+
Apache Camel
+
+
+
+
+
It also provides points of entry to integrate with any other solution on the market.
+
+
+
Stub triggering
+
+
To trigger a message it’s enough to use the StubTigger interface:
+
+
+
+
package io.codearte.accurest.stubrunner
+
+interface StubTrigger {
+
+ /**
+ * Triggers an event by a given label for a given {@code groupid:artifactid} notation. You can use only {@code artifactId} too.
+ *
+ * Feature related to messaging.
+ *
+ * @return true - if managed to run a trigger
+ */
+ boolean trigger(String ivyNotation, String labelName)
+
+ /**
+ * Triggers an event by a given label.
+ *
+ * Feature related to messaging.
+ *
+ * @return true - if managed to run a trigger
+ */
+ boolean trigger(String labelName)
+
+ /**
+ * Triggers all possible events.
+ *
+ * Feature related to messaging.
+ *
+ * @return true - if managed to run a trigger
+ */
+ boolean trigger()
+
+ /**
+ * Returns a mapping of ivy notation of a dependency to all the labels it has.
+ *
+ * Feature related to messaging.
+ */
+ Map<String, Collection<String>> labels()
+}
+
+
+
+
For convenience the StubFinder interface extends StubTrigger so it’s enough to use only one in your tests.
+
+
+
StubTrigger gives you the following options to trigger a message:
Accurest Stub Runner’s messaging module gives you an easy way to integrate with Apache Camel.
+For the provided artifacts it will automatically download the stubs and register the required
+routes.
+
+
+
Adding it to the project
+
+
To use it you have to add the following dependency to your project (example for Gradle):
Since the route is set for you it’s enough to just send a message to the jms:output destination.
+
+
+
+
camelContext.createProducerTemplate().sendBodyAndHeaders('jms:delete', new BookReturned('foo'), [sample: 'header'])
+
+
+
+
+
+
+
Stub Runner Messaging Integration
+
+
Accurest Stub Runner’s messaging module gives you an easy way to integrate with Spring Integration.
+For the provided artifacts it will automatically download the stubs and register the required
+routes.
+
+
+
Adding it to the project
+
+
To use it you have to add the following dependency to your project (example for Gradle):
Accurest Stub Runner’s messaging module gives you an easy way to integrate with Spring Stream.
+For the provided artifacts it will automatically download the stubs and register the required
+routes.
+
+
+
+
+
+
+
+
+In Stub Runner’s integration with Stream the messageFrom or sentTo Strings are resolved
+first as a destination of a channel, and then if there is no such destination it’s resolved as a
+channel name.
+
+
+
+
+
+
Adding it to the project
+
+
To use it you have to add the following dependency to your project (example for Gradle):
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/images/Deps.png b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/images/Deps.png
new file mode 100644
index 0000000000..1426814308
Binary files /dev/null and b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/images/Deps.png differ
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/images/Stubs1.png b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/images/Stubs1.png
new file mode 100644
index 0000000000..ebadfdb910
Binary files /dev/null and b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/images/Stubs1.png differ
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/images/Stubs2.png b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/images/Stubs2.png
new file mode 100644
index 0000000000..e4bad24987
Binary files /dev/null and b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/images/Stubs2.png differ
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/index.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/index.adoc
new file mode 120000
index 0000000000..28dc0a7e0c
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/index.adoc
@@ -0,0 +1 @@
+spring-cloud-contract-verifier.adoc
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/introduction.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/introduction.adoc
new file mode 100644
index 0000000000..86eb75f37d
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/introduction.adoc
@@ -0,0 +1,148 @@
+:images_url: https://raw.githubusercontent.com/Codearte/accurest/master/docs/src/main/asciidoc/images
+
+== Introduction
+
+IMPORTANT: http://codearte.github.io/accurest/deprecated[The documentation to the deprecated Accurest project in version 1.1.0 is available here.]
+
+TIP: The Accurest project was initially started by Marcin Grzejszczak and Jakub Kubrynski (http://codearte.io[codearte.io])
+
+Just to make long story short - Spring Cloud Contract Verifier is a tool that enables Consumer Driven Contract (CDC) development of JVM-based applications. It is shipped
+with __Contract Definition Language__ (DSL). Contract definitions are used to produce following resources:
+
+* JSON stub definitions to be used by Wiremock when doing integration testing on the client code (__client tests__).
+Test code must still be written by hand, test data is produced by Spring Cloud Contract Verifier.
+* Messaging routes if you're using one. We're integrating with Spring Integration, Spring Cloud Stream and Apache Camel. You can however set your own integrations if you want to
+* Acceptance tests (in JUnit or Spock) used to verify if server-side implementation of the API is compliant with the contract (__server tests__).
+Full test is generated by Spring Cloud Contract Verifier.
+
+Spring Cloud Contract Verifier moves TDD to the level of software architecture.
+
+=== Why?
+
+Let us assume that we have a system comprising of multiple microservices:
+
+image::{images_url}/Deps.png[Microservices Architecture]
+
+==== Testing issues
+
+If we wanted to test the application in top left corner if it can communicate with other services then we could do one of two things:
+
+- deploy all microservices and perform end to end tests
+- mock other microservices in unit / integration tests
+
+Both have their advantages but also a lot of disadvantages. Let's focus on the latter.
+
+*Deploy all microservices and perform end to end tests*
+
+Advantages:
+
+- simulates production
+- tests real communication between services
+
+Disadvantages:
+
+- to test one microservice we would have to deploy 6 microservices, a couple of databases etc.
+- the environment where the tests would be conducted would be locked for a single suite of tests (i.e. nobody else would be able to run the tests in the meantime).
+- long to run
+- very late feedback
+- extremely hard to debug
+
+*Mock other microservices in unit / integration tests*
+
+Advantages:
+
+- very fast feedback
+- no infrastructure requirements
+
+Disadvantages:
+
+- the implementor of the service creates stubs thus they might have nothing to do with the reality
+- you can go to production with passing tests and failing production
+
+To solve the aforementioned issues Spring Cloud Contract Verifier with Stub Runner were created. Their main idea is to give you very fast feedback, without the need
+to set up the whole world of microservices.
+
+image::{images_url}/Stubs1.png[Stubbed Services]
+
+If you work on stubs then the only applications you need are those that your application is using directly.
+
+image::{images_url}/Stubs2.png[Stubbed Services]
+
+Spring Cloud Contract Verifier gives you the certainty that the stubs that you're using were created by the service that you're calling. Also if you can use them it means that they were
+tested against the producer's side. In other words - you can trust those stubs.
+
+
+=== Purposes
+
+The main purposes of Spring Cloud Contract Verifier with Stub Runner are:
+
+ - to ensure that WireMock / Messaging stubs (used when developing the client) are doing exactly what actual server-side implementation will do,
+ - to promote ATDD method and Microservices architectural style,
+ - to provide a way to publish changes in contracts that are immediately visible on both sides,
+ - to generate boilerplate test code used on the server side.
+
+=== Client Side
+
+During the tests you want to have a Wiremock instance / Messaging route up and running that simulates the service Y.
+You would like to feed that instance with a proper stub definition. That stub definition would need
+to be valid and should also be reusable on the server side.
+
+__Summing it up:__ On this side, in the stub definition, you can use patterns for request stubbing and you need exact
+values for responses.
+
+=== Server Side
+
+Being a service Y since you are developing your stub, you need to be sure that it's actually resembling your
+concrete implementation. You can't have a situation where your stub acts in one way and your application on
+production behaves in a different way.
+
+That's why from the provided stub acceptance tests will be generated that will ensure
+that your application behaves in the same way as you define in your stub.
+
+__Summing it up:__ On this side, in the stub definition, you need exact values as request and can use patterns/methods
+for response verification.
+
+=== Dependencies
+
+Spring Cloud Contract Verifier and Stub Runner are using the following libraries
+
+- http://wiremock.org/[WireMock]
+- https://github.com/jayway/JsonPath[Jayway JSONPath]
+- https://github.com/marcingrzejszczak/jsonassert[JSONAssert from Marcin Grzejszczak]
+
+=== Additional links
+
+Below you can find some resources related to Spring Cloud Contract Verifier and Stub Runner. Note that some can be outdated since the Spring Cloud Contract Verifier project
+is under constant development.
+
+==== Videos
+
+*Olga Maciaszek-Sharma talking about Accurest (Spring Cloud Contract Verifier predecessor)*
+
+video::daafmTYFoDU[youtube]
+
+*Marcin Grzejszczak and Jakub Kubryński talking about Accurest (Spring Cloud Contract Verifier predecessor)*
+
+video::130779882[vimeo]
+
+==== Readings
+
+- http://www.slideshare.net/MarcinGrzejszczak/stick-to-the-rules-consumer-driven-contracts-201507-confitura[Slides from Marcin Grzejszczak's talk about Accurest]
+- http://toomuchcoding.com/blog/categories/accurest/[Accurest related articles from Marcin Grzejszczak's blog]
+
+=== Samples
+
+Here you can find some https://github.com/Codearte/accurest-samples[working samples]. Check the readme of each project for more information.
+
+=== Why use Spring Cloud Contract Verifier and not X ?
+
+For the time being Spring Cloud Contract Verifier is a JVM based tool. So it could be your first pick when you're already creating
+software for the JVM. This project has a lot of really interesting features but especially quite a few of them definitely make
+Spring Cloud Contract Verifier stand out on the "market" of Consumer Driven Contract (CDC) tooling. Out of many the most interesting are:
+
+- Possibility to do CDC with messaging
+- Clear and easy to use, statically typed DSL
+- Possibility to copy paste your current JSON file to the contract and only edit its elements
+- Automatic generation of tests from the defined Contract
+- Stub Runner functionality - the stubs are automatically downloaded at runtime from Nexus / Artifactory
+- Spring Cloud integration - no discovery service is needed for integration tests
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/links.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/links.adoc
new file mode 100644
index 0000000000..e8e1df762b
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/links.adoc
@@ -0,0 +1,11 @@
+== Links
+
+Here you can find interesting links related to Spring Cloud Contract Verifier:
+
+- https://github.com/Codearte/accurest[Spring Cloud Contract Verifier Github Repository]
+- http://codearte.github.io/accurest[Spring Cloud Contract Verifier Documentation]
+- http://codearte.github.io/accurest/deprecated[Accurest Legacy Documentation]
+- https://codearte.github.io/accurest/#spring-cloud-contract-stub-runner[Spring Cloud Contract Stub Runner Documentation]
+- http://codearte.github.io/accurest/#stub-runner-for-messaging[Spring Cloud Contract Stub Runner Messaging Documentation]
+- https://gitter.im/Codearte/accurest[Spring Cloud Contract Verifier Gitter]
+- https://github.com/Codearte/accurest-maven-plugin[Spring Cloud Contract Verifier Maven Plugin]
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/messaging.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/messaging.adoc
new file mode 100644
index 0000000000..24bc2bc272
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/messaging.adoc
@@ -0,0 +1,150 @@
+:core_path: ../../../..
+:verifier_root_path: {core_path}/spring-cloud-contract-verifier
+:verifier_core_path: {verifier_root_path}/spring-cloud-contract-verifier-core
+
+== Spring Cloud Contract Verifier Messaging
+
+Spring Cloud Contract Verifier allows you to verify your application that uses messaging as means of communication.
+All of our integrations are working with Spring but you can also set one yourself.
+
+=== Integrations
+
+You can use one of the three integration configurations:
+
+- Apache Camel
+- Spring Integration
+- Spring Cloud Stream
+
+If you're using Spring Boot, the aforementioned test configurations will be appended automatically.
+
+You have to provide as a dependency one of the Spring Cloud Contract Verifier Messaging modules. Example for Gradle:
+
+[source,groovy,indent=0]
+----
+// for Apache Camel
+testCompile "org.springframework.cloud.contract:spring-cloud-contract-verifier-camel:${verifierVersion}"
+// for Spring Integration
+testCompile "org.springframework.cloud.contract:spring-cloud-contract-verifier-integration:${verifierVersion}"
+// for Spring Cloud Stream
+testCompile "org.springframework.cloud.contract:spring-cloud-contract-verifier-stream:${verifierVersion}"
+----
+
+=== Manual Integration
+
+The `spring-cloud-contract-verifier-messaging-core` module contains 3 main interfaces:
+
+- `ContractVerifierMessage` - describes a message received / sent to a channel / queue / topic etc.
+- `ContractVerifierMessageBuilder` - describes how to build a message
+- `ContractVerifierMessaging` - class that allows you to build, send and receive messages
+- `ContractVerifierFilter` - interface to filter out the messages that do not follow the pattern from the DSL
+
+In the generated test the `ContractVerifierMessaging` is injected via `@Inject` annotation thus you can use other injection
+frameworks than Spring.
+
+You have to provide as a dependency the `spring-cloud-contract-verifier-messaging-core` module. Example for Gradle:
+
+[source,groovy,indent=0]
+----
+testCompile "org.springframework.cloud.contract:spring-cloud-contract-verifier-messaging-core:${verifierVersion}"
+----
+
+=== Publisher side test generation
+
+Having the `input` or `outputMessage` sections in your DSL will result in creation of tests on the publisher's side. By default
+JUnit tests will be created, however there is also a possibility to create Spock tests.
+
+There are 3 main scenarios that we should take into consideration:
+
+- Scenario 1: there is no input message that produces an output one. The output message is triggered by a component
+inside the application (e.g. scheduler)
+- Scenario 2: the input message triggers an output message
+- Scenario 3: the input message is consumed and there is no output message
+
+==== Scenario 1 (no input message)
+
+For the given contract:
+
+[source,groovy]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MessagingMethodBodyBuilderSpec.groovy[tags=trigger_method_dsl]
+----
+
+The following JUnit test will be created:
+
+[source,groovy]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MessagingMethodBodyBuilderSpec.groovy[tags=trigger_method_junit_test]
+----
+
+And the following Spock test would be created:
+
+[source,groovy]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MessagingMethodBodyBuilderSpec.groovy[tags=trigger_method_test]
+----
+
+==== Scenario 2 (output triggered by input)
+
+For the given contract:
+
+[source,groovy]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MessagingMethodBodyBuilderSpec.groovy[tags=trigger_message_dsl]
+----
+
+The following JUnit test will be created:
+
+[source,groovy]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MessagingMethodBodyBuilderSpec.groovy[tags=trigger_message_junit]
+----
+
+And the following Spock test would be created:
+
+[source,groovy]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MessagingMethodBodyBuilderSpec.groovy[tags=trigger_message_spock]
+----
+
+==== Scenario 3 (no output message)
+
+For the given contract:
+
+[source,groovy]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MessagingMethodBodyBuilderSpec.groovy[tags=trigger_no_output_dsl]
+----
+
+The following JUnit test will be created:
+
+[source,groovy]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MessagingMethodBodyBuilderSpec.groovy[tags=trigger_no_output_junit]
+----
+
+And the following Spock test would be created:
+
+[source,groovy]
+----
+include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MessagingMethodBodyBuilderSpec.groovy[tags=trigger_no_output_spock]
+----
+
+=== Consumer Stub Side generation
+
+Unlike the HTTP part - in Messaging we need to publish the Groovy DSL inside the JAR with a stub. Then it's parsed on the consumer side
+and proper stubbed routes are created.
+
+For more infromation please consult the Stub Runner Messaging sections.
+
+==== Gradle Setup
+
+Example of Spring Cloud Contract Verifier Gradle setup:
+
+[source,groovy,indent=0]
+----
+include::{verifier_root_path}/spring-cloud-contract-verifier-gradle-plugin/src/test/resources/functionalTest/scenarioProject/build.gradle[tags=jar_setup,indent=0]
+----
+
+==== Maven Setup
+
+Example of Maven can be found in the https://github.com/Codearte/accurest-maven-plugin/=publishing-wiremock-stubs-projectf-stubsjar[Spring Cloud Contract Verifier Maven Plugin README]
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/rest.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/rest.adoc
new file mode 100644
index 0000000000..843d396ec6
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/rest.adoc
@@ -0,0 +1,437 @@
+:core_path: ../../../..
+:verifier_root_path: {core_path}/spring-cloud-contract-verifier
+:verifier_core_path: {verifier_root_path}/spring-cloud-contract-verifier-core
+
+== Spring Cloud Contract Verifier HTTP
+
+=== Gradle Project
+
+==== Prerequisites
+
+In order to use Spring Cloud Contract Verifier with Wiremock you have to use gradle or maven plugin.
+
+===== Add gradle plugin
+
+[source,groovy,indent=0]
+----
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'org.springframework.cloud.contract:spring-cloud-contract-verifier-gradle-plugin:${verifier_version}'
+ }
+}
+
+apply plugin: 'groovy'
+apply plugin: 'contract-verifier'
+
+dependencies {
+ testCompile 'org.codehaus.groovy:groovy-all:2.4.6'
+ testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
+ testCompile 'com.jayway.restassured:spring-mock-mvc:2.9.0' // needed if you're going to use Spring MockMvc
+}
+----
+
+====== Snapshot versions
+
+Add the additional snapshot repository to your build.gradle to use snapshot versions which are automatically uploaded after every successful build:
+
+[source,groovy,indent=0]
+----
+repositories {
+ (...)
+ //Required only for SNAPSHOT versions
+ maven { url "https://repo.spring.io/plugins-snapshot-local" }
+}
+----
+
+===== Add maven plugin
+
+[source,xml,indent=0]
+----
+
+ org.springframework.cloud.contract
+ spring-cloud-contract-verifier-maven-plugin
+
+
+
+ convert
+ generateStubs
+ generateTests
+
+
+
+
+----
+
+
+Read more: http://codearte.github.io/accurest-maven-plugin/[spring-cloud-contract-verifier-maven-plugin]
+
+===== Add stubs
+
+By default Spring Cloud Contract Verifier is looking for stubs in `src/test/resources/contracts` directory.
+
+Directory containing stub definitions is treated as a class name, and each stub definition is treated as a single test.
+We assume that it contains at least one directory which will be used as test class name. If there is more than one level of nested directories all except the last one will be used as package name.
+So with following structure
+
+[source,groovy,indent=0]
+----
+src/test/resources/contracts/myservice/shouldCreateUser.groovy
+src/test/resources/contracts/myservice/shouldReturnUser.groovy
+----
+
+Spring Cloud Contract Verifier will create test class `defaultBasePackage.MyService` with two methods
+
+ - `shouldCreateUser()`
+ - `shouldReturnUser()`
+
+==== Run plugin
+
+Plugin registers itself to be invoked before `check` task. You have nothing to do as long as you want it to be part of your build process. If you just want to generate tests please invoke `generateContractTests` task.
+
+==== Default setup
+
+Default Gradle Plugin setup creates the following Gradle part of the build (it's a pseudocode)
+
+[source,groovy,indent=0]
+----
+contractVerifier {
+ targetFramework = 'JUNIT'
+ testMode = 'MockMvc'
+ generatedTestSourcesDir = project.file("${project.buildDir}/generated-test-sources/contracts")
+ contractsDslDir = "${project.rootDir}/src/test/resources/contracts"
+ basePackageForTests = 'org.springframework.cloud.contract.verifier.tests'
+ stubsOutputDir = project.file("${project.buildDir}/stubs")
+}
+
+tasks.create(type: Jar, name: 'verifierStubsJar', dependsOn: 'generateWireMockClientStubs') {
+ baseName = project.name
+ classifier = contractVerifier.stubsSuffix
+ from contractVerifier.stubsOutputDir
+}
+
+project.artifacts {
+ archives task
+}
+
+tasks.create(type: Copy, name: 'copyContracts') {
+ from contractVerifier.contractsDslDir
+ into contractVerifier.stubsOutputDir
+}
+
+verifierStubsJar.dependsOn 'copyContracts'
+
+publishing {
+ publications {
+ stubs(MavenPublication) {
+ artifactId project.name
+ artifact verifierStubsJar
+ }
+ }
+}
+----
+
+==== Configure plugin
+
+To change default configuration just add `contractVerifier` snippet to your Gradle config
+
+[source,groovy,indent=0]
+----
+contractVerifier {
+ testMode = 'MockMvc'
+ baseClassForTests = 'org.mycompany.tests'
+ generatedTestSourcesDir = project.file('src/generatedContract')
+}
+----
+
+===== Configuration options
+
+ - **testMode** - defines mode for acceptance tests. By default MockMvc which is based on Spring's MockMvc. It can also be changed to **JaxRsClient** or to **Explicit** for real HTTP calls.
+ - **imports** - array with imports that should be included in generated tests (for example ['org.myorg.Matchers']). By default empty array []
+ - **staticImports** - array with static imports that should be included in generated tests(for example ['org.myorg.Matchers.*']). By default empty array []
+ - **basePackageForTests** - specifies base package for all generated tests. By default set to org.springframework.cloud.contract.verifier.tests
+ - **baseClassForTests** - base class for generated tests. By default `spock.lang.Specification` if using Spock tests.
+ - **ruleClassForTests** - specifies Rule which should be added to generated test classes.
+ - **ignoredFiles** - Ant matcher allowing defining stub files for which processing should be skipped. By default empty array []
+ - **contractsDslDir** - directory containing contracts written using the GroovyDSL. By default `$rootDir/src/test/resources/contracts`
+ - **generatedTestSourcesDir** - test source directory where tests generated from Groovy DSL should be placed. By default `$buildDir/generated-test-sources/contractVerifier`
+ - **stubsOutputDir** - dir where the generated WireMock stubs from Groovy DSL should be placed
+ - **targetFramework** - the target test framework to be used; currently Spock and JUnit are supported with JUnit being the default framework
+
+===== Base class for tests
+
+When using Spring Cloud Contract Verifier in default MockMvc you need to create a base specification for all generated acceptance tests. In this class you need to point to endpoint which should be verified.
+
+[source,groovy,indent=0]
+----
+include::{verifier_root_path}/spring-cloud-contract-verifier-gradle-plugin/src/test/resources/functionalTest/bootSimple/src/test/groovy/org/springframework/cloud/contract/verifier/twitter/places/BaseMockMvcSpec.groovy[tags=base_class,indent=0]
+----
+
+In case of using `Explicit` mode, you can use base class to initialize the whole tested app similarly as in regular integration tests. In case of `JAXRSCLIENT` mode this base class
+should also contain `protected WebTarget webTarget` field, right now the only option to test JAX-RS API is to start a web server.
+
+==== Invoking generated tests
+
+To ensure that provider side is complaint with defined contracts, you need to invoke:
+
+[source,bash,indent=0]
+----
+./gradlew generateContractTests test
+----
+
+==== Spring Cloud Contract Verifier on consumer side
+
+In consumer service you need to configure Spring Cloud Contract Verifier plugin in exactly the same way as in case of provider. If you don't want to use Stub Runner then you need to copy contracts stored in
+`src/test/resources/contracts` and generate WireMock json stubs using:
+
+[source,bash,indent=0]
+----
+./gradlew generateWireMockClientStubs
+----
+
+Note that `stubsOutputDir` option has to be set for stub generation to work.
+
+When present, json stubs can be used in consumer automated tests.
+
+[source,groovy,indent=0]
+----
+@ContextConfiguration(loader == SpringApplicationContextLoader, classes == Application)
+class LoanApplicationServiceSpec extends Specification {
+
+ @ClassRule
+ @Shared
+ WireMockClassRule wireMockRule == new WireMockClassRule()
+
+ @Autowired
+ LoanApplicationService sut
+
+ def 'should successfully apply for loan'() {
+ given:
+ LoanApplication application =
+ new LoanApplication(client: new Client(pesel: '12345678901'), amount: 123.123)
+ when:
+ LoanApplicationResult loanApplication == sut.loanApplication(application)
+ then:
+ loanApplication.loanApplicationStatus === LoanApplicationStatus.LOAN_APPLIED
+ loanApplication.rejectionReason === null
+ }
+}
+----
+
+Underneath LoanApplication makes a call to FraudDetection service. This request is handled by Wiremock server configured using stubs generated by Spring Cloud Contract Verifier.
+
+=== Using in your Maven project
+
+==== Add maven plugin
+
+[source,xml,indent=0]
+----
+
+ org.springframework.cloud.contract.verifier
+ spring-cloud-contract-verifier-maven-plugin
+
+
+
+ convert
+ generateStubs
+ generateTests
+
+
+
+
+----
+
+Read more: http://codearte.github.io/accurest-maven-plugin/[spring-cloud-contract-verifier-maven-plugin]
+
+==== Add stubs
+
+By default Spring Cloud Contract Verifier is looking for stubs in `src/test/resources/contracts` directory.
+Directory containing stub definitions is treated as a class name, and each stub definition is treated as a single test.
+We assume that it contains at least one directory which will be used as test class name. If there is more than one level of nested directories all except the last one will be used as package name.
+So with following structure
+
+[source,groovy,indent=0]
+----
+src/test/resources/contracts/myservice/shouldCreateUser.groovy
+src/test/resources/contracts/myservice/shouldReturnUser.groovy
+----
+
+Spring Cloud Contract Verifier will create test class `defaultBasePackage.MyService` with two methods
+ - `shouldCreateUser()`
+ - `shouldReturnUser()`
+
+==== Run plugin
+
+Plugin goal `generateTests` is assigned to be invoked in phase `generate-test-sources`. You have nothing to do as long as you want it to be part of your build process. If you just want to generate tests please invoke `generateTests` goal.
+
+==== Configure plugin
+
+To change default configuration just add `configuration` section to plugin definition or `execution` definition.
+
+[source,xml,indent=0]
+----
+
+ org.springframework.cloud.contract.verifier
+ spring-cloud-contract-verifier-maven-plugin
+
+
+
+ convert
+ generateStubs
+ generateTests
+
+
+
+
+ org.springframework.cloud.contract.verifier.twitter.place
+ org.springframework.cloud.contract.verifier.twitter.place.BaseMockMvcSpec
+
+
+----
+
+===== Important configuration options
+
+ - **testMode** - defines mode for acceptance tests. By default `MockMvc` which is based on Spring's MockMvc. It can also be changed to `JaxRsClient` or to `Explicit` for real HTTP calls.
+ - **basePackageForTests** - specifies base package for all generated tests. By default set to `org.springframework.cloud.contract.verifier.tests`.
+ - **ruleClassForTests** - specifies Rule which should be added to generated test classes.
+ - **baseClassForTests** - base class for generated tests. By default `spock.lang.Specification` if using Spock tests.
+ - **contractsDir** - directory containing contracts written using the GroovyDSL. By default `/src/test/resources/contracts`.
+ - **testFramework** - the target test framework to be used; currently Spock and JUnit are supported with Spock being the default framework
+
+For complete information take a look at http://codearte.github.io/accurest-maven-plugin/plugin-info.html[Plugin Documentation]
+
+===== Base class for tests
+
+ When using Spring Cloud Contract Verifier in default MockMvc you need to create a base specification for all generated acceptance tests. In this class you need to point to endpoint which should be verified.
+
+[source,groovy,indent=0]
+----
+package org.mycompany.tests
+
+import org.mycompany.ExampleSpringController
+import com.jayway.restassured.module.mockmvc.RestAssuredMockMvc
+import spock.lang.Specification
+
+class MvcSpec extends Specification {
+ def setup() {
+ RestAssuredMockMvc.standaloneSetup(new ExampleSpringController())
+ }
+}
+----
+
+In case of using `Explicit` mode, you can use base class to initialize the whole tested app similarly as in regular integration tests. In case of `JAXRSCLIENT` mode this base class should also contain `protected WebTarget webTarget` field, right now the only option to test JAX-RS API is to start a web server.
+
+==== Invoking generated tests
+
+Spring Cloud Contract Verifier Maven Plugins generates verification code into directory `/generated-test-sources/contractVerifier` and attach this directory to `testCompile` goal.
+
+For Groovy Spock code use:
+
+[source,xml,indent=0]
+----
+
+ org.codehaus.gmavenplus
+ gmavenplus-plugin
+ 1.5
+
+
+
+ testCompile
+
+
+
+
+
+
+ ${project.basedir}/src/test/groovy
+
+ **/*.groovy
+
+
+
+ ${project.build.directory}/generated-test-sources/contractVerifier
+
+ **/*.groovy
+
+
+
+
+
+----
+
+To ensure that provider side is complaint with defined contracts, you need to invoke `mvn generateTest test`
+
+==== Spring Cloud Contract Verifier on consumer side
+
+In consumer service you need to configure Spring Cloud Contract Verifier plugin in exactly the same way as in case of provider. You need to copy contracts stored in `src/test/resources/contracts` and generate Wiremock json stubs using: `mvn generateStubs` command. By default generated WireMock mapping is stored in directory `target/mappings`. Your project should create from this generated mappings additional artifact with classifier `stubs` for easy deploy to maven repository.
+
+Sample configuration:
+
+[source,xml,indent=0]
+----
+
+ org.springframework.cloud.contract.verifier
+ spring-cloud-contract-verifier-maven-plugin
+ ${verifier-plugin.version}
+
+
+
+ convert
+ generateStubs
+
+
+
+
+----
+
+When present, json stubs can be used in consumer automated tests.
+
+[source,groovy,indent=0]
+----
+@ContextConfiguration(loader == SpringApplicationContextLoader, classes == Application)
+class LoanApplicationServiceSpec extends Specification {
+
+ @ClassRule
+ @Shared
+ WireMockClassRule wireMockRule == new WireMockClassRule()
+
+ @Autowired
+ LoanApplicationService sut
+
+ def 'should successfully apply for loan'() {
+ given:
+ LoanApplication application =
+ new LoanApplication(client: new Client(pesel: '12345678901'), amount: 123.123)
+ when:
+ LoanApplicationResult loanApplication == sut.loanApplication(application)
+ then:
+ loanApplication.loanApplicationStatus === LoanApplicationStatus.LOAN_APPLIED
+ loanApplication.rejectionReason === null
+ }
+}
+----
+
+Underneath LoanApplication makes a call to FraudDetection service. This request is handled by Wiremock server configured using stubs generated by Spring Cloud Contract Verifier.
+
+=== Scenarios
+
+It's possible to handle scenarios with Spring Cloud Contract Verifier. All you need to do is to stick to proper naming convention while creating your contracts. The convention requires to include order number followed by the underscore.
+
+[source,indent=0]
+----
+my_contracts_dir\
+ scenario1\
+ 1_login.groovy
+ 2_showCart.groovy
+ 3_logout.groovy
+----
+
+Such tree will cause Spring Cloud Contract Verifier generating Wiremock's scenario with name `scenario1` and three steps:
+ - login marked as `Started` pointing to:
+ - showCart marked as `Step1` pointing to:
+ - logout marked as `Step2` which will close the scenario.
+More details about Wiremock scenarios can be found under [http://wiremock.org/stateful-behaviour.html](http://wiremock.org/stateful-behaviour.html)
+
+Spring Cloud Contract Verifier will also generate tests with guaranteed order of execution.
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/spring-cloud-contract-verifier.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/spring-cloud-contract-verifier.adoc
new file mode 100644
index 0000000000..96cc64d927
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/spring-cloud-contract-verifier.adoc
@@ -0,0 +1,22 @@
+:core_path: ../../../..
+:verifier_root_path: {core_path}/spring-cloud-contract-verifier
+:verifier_core_path: {verifier_root_path}/spring-cloud-contract-verifier-core
+:stubrunner_core_path: {core_path}/spring-cloud-contract-stub-runner
+
+= Spring Cloud Contract Verifier
+
+_Documentation Authors: Adam Dudczak, Marcin Grzejszczak, Jakub Kubryński, Karol Lassak, Olga Maciaszek-Sharma, Mariusz Smykuła_
+
+include::introduction.adoc[]
+
+include::contract.adoc[]
+
+include::rest.adoc[]
+
+include::messaging.adoc[]
+
+include::stubrunner.adoc[]
+
+include::stubrunner_msg.adoc[]
+
+include::links.adoc[]
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/stubrunner.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/stubrunner.adoc
new file mode 100644
index 0000000000..6ba4fb98f9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/stubrunner.adoc
@@ -0,0 +1,97 @@
+:core_path: ../../../..
+:verifier_root_path: {core_path}/spring-cloud-contract-verifier
+:verifier_core_path: {verifier_root_path}/spring-cloud-contract-verifier-core
+
+== Spring Cloud Contract Stub Runner
+
+One of the issues that you could have encountered while using Spring Cloud Contract Verifier was to pass the generated WireMock JSON stubs from the server side to the client side (or various clients).
+ The same takes place in terms of client side generation for messaging.
+
+Copying the JSON files / setting the client side for messaging manually is out of the question.
+
+=== Snapshot versions
+
+Add the additional snapshot repository to your build.gradle to use snapshot versions which are automatically uploaded after every successful build:
+
+[source,groovy,indent=0]
+----
+repositories {
+ (...)
+ //Required only for SNAPSHOT versions
+ maven { url "https://repo.spring.io/libs-snapshot-local" }
+}
+----
+
+=== Publishing stubs as JARs
+
+The easiest approach would be to centralize the way stubs are kept. For example you can keep them as JARs in a Maven repository.
+
+==== Gradle
+
+Example of Spring Cloud Contract Verifier Gradle setup:
+
+[source,groovy,indent=0]
+----
+include::{verifier_root_path}/spring-cloud-contract-verifier-gradle-plugin/src/test/resources/functionalTest/scenarioProject/build.gradle[tags=jar_setup,indent=0]
+----
+
+==== Maven
+
+Example of Maven can be found in the https://github.com/Codearte/accurest-maven-plugin/=publishing-wiremock-stubs-projectf-stubsjar[Spring Cloud Contract Verifier Maven Plugin README]
+
+=== Modules
+
+Spring Cloud Contract Stub Runner comes with a new structure of modules
+
+[source,indent=0]
+----
+└── spring-cloud-contract-stub-runner
+ ├── spring-cloud-contract-stub-runner
+ ├── spring-cloud-contract-stub-runner-boot
+ ├── spring-cloud-contract-stub-runner-junit
+ ├── spring-cloud-contract-stub-runner-spring
+ └── spring-cloud-contract-stub-runner-spring-cloud
+----
+
+include::../../../../spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner/README.adoc[]
+
+include::../../../../spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner-boot/README.adoc[]
+
+include::../../../../spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner-junit/README.adoc[]
+
+include::../../../../spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner-spring/README.adoc[]
+
+include::../../../../spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner-spring-cloud/README.adoc[]
+
+
+=== Common properties for JUnit and Spring
+
+Some of the properties that are repetitive can be set using system properties or property sources (for Spring). Here are their names with their default values:
+
+[frame="topbot",options="header"]
+|======================
+| Property name | Default value | Description
+|stubrunner.port.range.min|10000| Minimal value of a port for a started WireMock with stubs
+|stubrunner.port.range.max|15000| Minimal value of a port for a started WireMock with stubs
+|stubrunner.stubs.repository.root|| Comma separated list of Maven repo urls. If blank then will call the local maven repo
+|stubrunner.stubs.classifier|stubs| Default classifier for the stub artifacts
+|stubrunner.work-offline|false| If true then will not contact any remote repositories to download stubs
+|stubrunner.stubs.ids|| Comma separated list of Ivy notation of stubs to download
+|======================
+
+==== Stub runner stubs ids
+
+You can provide the stubs to download via the `stubrunner.stubs.ids` system property. They follow the following pattern:
+
+[source,java,indent=0]
+----
+groupId:artifactId:version:classifier:port
+----
+
+`version`, `classifier` and `port` are optional.
+
+* If you don't provide the `port` then a random one will be picked
+* If you don't provide the `classifier` then the default one will be taken.
+* If you don't provide the `version` then the `+` will be passed and the latest one will be downloaded
+
+Where `port` means the port of the WireMock server.
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/stubrunner_msg.adoc b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/stubrunner_msg.adoc
new file mode 100644
index 0000000000..194076d611
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/asciidoc/stubrunner_msg.adoc
@@ -0,0 +1,61 @@
+:core_path: ../../../..
+:verifier_root_path: {core_path}/spring-cloud-contract-verifier
+:verifier_core_path: {verifier_root_path}/spring-cloud-contract-verifier-core
+:stubrunner_core_path: {core_path}/spring-cloud-contract-stub-runner
+
+== Stub Runner for Messaging
+
+Stub Runner has the functionality to run the published stubs in memory. It can integrate with the following frameworks out of the box
+
+- Spring Integration
+- Spring Cloud Stream
+- Apache Camel
+
+It also provides points of entry to integrate with any other solution on the market.
+
+=== Stub triggering
+
+To trigger a message it's enough to use the `StubTrigger` interface:
+
+[source,groovy]
+----
+include::{stubrunner_core_path}/spring-cloud-contract-stub-runner/src/main/groovy/org/springframework/cloud/contract/stubrunner/StubTrigger.groovy[]
+----
+
+For convenience the `StubFinder` interface extends `StubTrigger` so it's enough to use only one in your tests.
+
+`StubTrigger` gives you the following options to trigger a message:
+
+==== Trigger by label
+
+[source,groovy]
+----
+include::{stubrunner_core_path}/spring-cloud-contract-stub-runner-messaging/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=client_trigger,indent=0]
+----
+
+===== Trigger by group and artifact ids
+
+[source,groovy]
+----
+include::{stubrunner_core_path}/spring-cloud-contract-stub-runner-messaging/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=trigger_group_artifact,indent=0]
+----
+
+===== Trigger by artifact ids
+
+[source,groovy]
+----
+include::{stubrunner_core_path}/spring-cloud-contract-stub-runner-messaging/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=trigger_artifact,indent=0]
+----
+
+===== Trigger all messages
+
+[source,groovy]
+----
+include::{stubrunner_core_path}/spring-cloud-contract-stub-runner-messaging/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=trigger_all,indent=0]
+----
+
+include::{stubrunner_core_path}/spring-cloud-contract-stub-runner-messaging/spring-cloud-contract-stub-runner-camel/README.adoc[]
+
+include::{stubrunner_core_path}/spring-cloud-contract-stub-runner-messaging/spring-cloud-contract-stub-runner-integration/README.adoc[]
+
+include::{stubrunner_core_path}/spring-cloud-contract-stub-runner-messaging/spring-cloud-contract-stub-runner-stream/README.adoc[]
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/ruby/generate_readme.sh b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/ruby/generate_readme.sh
new file mode 100755
index 0000000000..6d0ce9dc54
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/docs/src/main/ruby/generate_readme.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env ruby
+
+base_dir = File.join(File.dirname(__FILE__),'../../..')
+src_dir = File.join(base_dir, "/src/main/asciidoc")
+require 'asciidoctor'
+require 'optparse'
+
+options = {}
+file = "#{src_dir}/README.adoc"
+
+OptionParser.new do |o|
+ o.on('-o OUTPUT_FILE', 'Output file (default is stdout)') { |file| options[:to_file] = file unless file=='-' }
+ o.on('-h', '--help') { puts o; exit }
+ o.parse!
+end
+
+file = ARGV[0] if ARGV.length>0
+
+# Copied from https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/scripts/asciidoc-coalescer.rb
+doc = Asciidoctor.load_file file, safe: :unsafe, header_only: true, attributes: options[:attributes]
+header_attr_names = (doc.instance_variable_get :@attributes_modified).to_a
+header_attr_names.each {|k| doc.attributes[%(#{k}!)] = '' unless doc.attr? k }
+attrs = doc.attributes
+attrs['allow-uri-read'] = true
+puts attrs
+
+out = "// Do not edit this file (e.g. go instead to src/main/asciidoc)\n\n"
+doc = Asciidoctor.load_file file, safe: :unsafe, parse: false, attributes: attrs
+out << doc.reader.read
+
+unless options[:to_file]
+ puts out
+else
+ File.open(options[:to_file],'w+') do |file|
+ file.write(out)
+ end
+end
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/generateReadme.sh b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/generateReadme.sh
new file mode 100755
index 0000000000..1638d7b172
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/generateReadme.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+./gradlew :docs:clean :docs:generateReadme --configure-on-demand
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradle.properties b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradle.properties
new file mode 100644
index 0000000000..91057965e2
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradle.properties
@@ -0,0 +1,33 @@
+#
+# Copyright 2013-2016 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+nexusUsername =
+nexusPassword =
+
+wiremockVersion = 2.0.10-beta
+jsonassertVersion = 0.4.7
+
+BOM_VERSION=Brixton-SR1
+springBootVersion=1.3.3.RELEASE
+springVersion=4.2.5.RELEASE
+springIntegrationDslVersion=1.1.2.RELEASE
+springStreamVersion=1.0.0.RELEASE
+springCloudVersion=1.1.0.RELEASE
+springCloudZookeeperVersion=1.0.0.RELEASE
+camelVersion=2.17.0
+aetherVersion=1.1.0
+
+verifierVersion=1.0.0.BUILD-SNAPSHOT
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradle/release.gradle b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradle/release.gradle
new file mode 100644
index 0000000000..ae90a8c9d7
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradle/release.gradle
@@ -0,0 +1,92 @@
+apply plugin: 'maven'
+apply plugin: 'signing'
+
+ext {
+ resolveRepoName = { Project project ->
+ String version = project.version
+ String name = project.name
+ String resolvedRepoName = "libs-${resolveVersion(version)}-local"
+ if (name.contains("gradle")) {
+ resolvedRepoName = "plugins-${resolveVersion(version)}-local"
+ }
+ logger.lifecycle("For project [$project.name] with " +
+ "version [$project.version] the resolved Artifactory repo is [$resolvedRepoName]")
+ return resolvedRepoName
+ }
+
+ resolveVersion = { String version ->
+ if (version.endsWith('BUILD-SNAPSHOT')) return 'snapshot'
+ if (version.matches('[0-9].[0-9].[0-9].M[0-9]+')) return 'milestone'
+ if (version.matches('[0-9].[0-9].[0-9].RC[0-9]+')) return 'milestone'
+ if (version.endsWith('RELEASE')) return 'release'
+ return 'snapshot'
+ }
+
+ isReleaseVersion = !version.endsWith("SNAPSHOT")
+}
+
+uploadArchives.dependsOn { [check] }
+
+ext {
+ repositoryUrl = "https://repo.spring.io/${repoPrefix()}-${resolveVersion(version)}-local"
+ snapshotRepositoryUrl = "https://repo.spring.io/${repoPrefix()}-snapshot-local"
+ repoUrl = isReleaseVersion ? repositoryUrl : snapshotRepositoryUrl
+}
+
+afterEvaluate {
+ uploadArchives {
+ repositories {
+ mavenDeployer {
+ // POM signature
+ if (isReleaseVersion) {
+ beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
+ }
+ // Target repository
+ repository(url: repoUrl) {
+ authentication(userName: repoUser, password: repoPass)
+ }
+ pom.project {
+ name "$project.name"
+ packaging 'jar'
+ description 'Consumer Driven Contract Verifier and Stub Runner'
+ url 'https://github.com/Codearte/accurest'
+ inceptionYear '2014'
+
+ scm {
+ connection 'scm:git:git@github.com:Codearte/accurest.git'
+ developerConnection 'scm:git:git@github.com:Codearte/accurest.git'
+ url 'https://github.com/Codearte/accurest'
+ }
+
+ licenses {
+ license {
+ name 'The Apache License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ }
+ }
+
+ developers {
+ developer {
+ id 'jkubrynski'
+ name 'Jakub Kubrynski'
+ email 'jk ATT codearte DOTT io'
+ }
+ developer {
+ id 'marcingrzejszczak'
+ name 'Marcin Grzejszczak'
+ email 'marcin ATT grzejszczak DOTT pl'
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+String repoPrefix() {
+ return project.name.contains('gradle') ? 'plugins' : 'libs'
+}
+
+if (projectsToSkipPublication.any { project.name.contains(it) }) {
+ uploadArchives.enabled = false
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000..72e5e30b39
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Jun 15 17:19:08 CEST 2016
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradlew b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradlew
new file mode 100755
index 0000000000..9d82f78915
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradlew.bat b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradlew.bat
new file mode 100644
index 0000000000..5f192121eb
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/publishDocs.sh b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/publishDocs.sh
new file mode 100755
index 0000000000..17ed699b55
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/publishDocs.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+./gradlew :docs:clean :docs:publishGhPages --configure-on-demand
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/build.gradle b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/build.gradle
new file mode 100644
index 0000000000..bf8efc7f10
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/build.gradle
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+String verifier = "spring-cloud-contract-verifier"
+
+dependencies {
+ compile project(":$verifier-root:$verifier-core")
+ compile "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}"
+ compile "org.apache.camel:camel-spring-boot-starter:${camelVersion}"
+ compile "org.apache.camel:camel-jms:${camelVersion}"
+ compile 'org.apache.activemq:activemq-camel:5.12.1'
+ compile 'org.apache.activemq:activemq-pool:5.12.1'
+ compile "org.apache.camel:camel-jackson:${camelVersion}"
+
+ testCompile project(":$verifier-root:$verifier-messaging-root:$verifier-camel")
+ testCompile "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
+ testCompile('org.spockframework:spock-spring:1.0-groovy-2.4') {
+ exclude(group: 'org.codehaus.groovy')
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleted.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleted.groovy
new file mode 100644
index 0000000000..52af5fd871
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleted.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.camel
+
+import com.fasterxml.jackson.annotation.JsonCreator
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class BookDeleted implements Serializable {
+ final String bookName
+
+ @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
+ BookDeleted(String bookName) {
+ this.bookName = bookName
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleter.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleter.groovy
new file mode 100644
index 0000000000..c1ad517de9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleter.groovy
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.camel
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.apache.camel.Exchange
+import org.springframework.stereotype.Component
+
+import java.util.concurrent.atomic.AtomicBoolean
+
+@CompileStatic
+@Slf4j
+@Component
+class BookDeleter {
+
+ /**
+ Scenario for "should generate tests triggered by a message":
+ client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
+ server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
+ */
+ void bookDeleted(Exchange exchange) {
+ BookDeleted bookDeleted = exchange.in.getBody(BookDeleted)
+ log.info("Deleting book [$bookDeleted]")
+ bookSuccessfulyDeleted.set(true)
+ log.info("Book successfuly deleted [$bookSuccessfulyDeleted]")
+ }
+
+ AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false)
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookReturned.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookReturned.groovy
new file mode 100644
index 0000000000..373743a094
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookReturned.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.camel
+
+import com.fasterxml.jackson.annotation.JsonCreator
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class BookReturned implements Serializable {
+ final String bookName
+
+ @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
+ BookReturned(String bookName) {
+ this.bookName = bookName
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookRouteConfiguration.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookRouteConfiguration.groovy
new file mode 100644
index 0000000000..06ed844919
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookRouteConfiguration.groovy
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.camel
+
+import org.apache.activemq.camel.component.ActiveMQComponent
+import org.apache.camel.RoutesBuilder
+import org.apache.camel.model.dataformat.JsonLibrary
+import org.apache.camel.spring.SpringRouteBuilder
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+/**
+ * @author Marcin Grzejszczak
+ */
+@Configuration
+class BookRouteConfiguration {
+
+ @Bean
+ ActiveMQComponent activeMQComponent(@Value('${activemq.url:vm://localhost?broker.persistent=false}') String url) {
+ return new ActiveMQComponent(brokerURL: url)
+ }
+
+ @Bean
+ RoutesBuilder myRouter(BookService bookService, BookDeleter bookDeleter) {
+ return new SpringRouteBuilder() {
+
+ @Override
+ public void configure() throws Exception {
+ // scenario 1 - from bean to output
+ from("direct:start").unmarshal().json(JsonLibrary.Jackson, BookReturned).bean(bookService).to("jms:output")
+ // scenario 2 - from input to output
+ from("jms:input").unmarshal().json(JsonLibrary.Jackson, BookReturned).bean(bookService).to("jms:output")
+ // scenario 3 - from input to no output
+ from("jms:delete").unmarshal().json(JsonLibrary.Jackson, BookDeleted).bean(bookDeleter)
+ }
+
+ };
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookService.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookService.groovy
new file mode 100644
index 0000000000..f60ec6fbe9
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookService.groovy
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.camel
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.apache.camel.Exchange
+import org.springframework.stereotype.Service
+
+@Service
+@CompileStatic
+@Slf4j
+class BookService {
+
+ /**
+ Scenario for "should generate tests triggered by a method":
+ client side: must have a possibility to "trigger" sending of a message to the given messageFrom
+ server side: will run the method and await upon receiving message on the output messageFrom
+
+ Method triggers sending a message to a source
+ */
+ void returnBook(Exchange exchange) {
+ BookReturned bookReturned = exchange.in.getBody(BookReturned)
+ log.info("Returning book [$bookReturned]")
+ exchange.out.with {
+ body = bookReturned
+ setHeader('BOOK-NAME', bookReturned.bookName)
+ }
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplication.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplication.groovy
new file mode 100644
index 0000000000..da6bddcb83
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplication.groovy
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.camel
+
+import org.springframework.boot.SpringApplication
+import org.springframework.boot.autoconfigure.SpringBootApplication
+
+@SpringBootApplication
+class CamelMessagingApplication {
+
+ static void main(String[] args) {
+ SpringApplication.run(CamelMessagingApplication.class, args)
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/test/groovy/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplicationSpec.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/test/groovy/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplicationSpec.groovy
new file mode 100644
index 0000000000..09f5a23df7
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-camel/src/test/groovy/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplicationSpec.groovy
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.camel
+
+import com.jayway.jsonpath.DocumentContext
+import com.jayway.jsonpath.JsonPath
+import com.toomuchcoding.jsonassert.JsonAssertion
+import org.springframework.cloud.contract.spec.Contract
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessage
+import org.apache.camel.model.ModelCamelContext
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.test.SpringApplicationContextLoader
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessaging
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierObjectMapper
+import org.springframework.test.context.ContextConfiguration
+import spock.lang.Specification
+import spock.util.concurrent.PollingConditions
+
+import javax.inject.Inject
+/**
+ * SPIKE ON TESTS FROM NOTES IN MessagingSpec
+ */
+// Context configuration would end up in base class
+@ContextConfiguration(classes = [CamelMessagingApplication], loader = SpringApplicationContextLoader)
+public class CamelMessagingApplicationSpec extends Specification {
+
+ // ALL CASES
+ @Inject ContractVerifierMessaging contractVerifierMessaging
+ ContractVerifierObjectMapper contractVerifierObjectMapper = new ContractVerifierObjectMapper()
+
+ def "should work for triggered based messaging"() {
+ given:
+ def dsl = Contract.make {
+ label 'some_label'
+ input {
+ triggeredBy('bookReturnedTriggered()')
+ }
+ outputMessage {
+ sentTo('activemq:output')
+ body('''{ "bookName" : "foo" }''')
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+ }
+ // generated test should look like this:
+ when:
+ bookReturnedTriggered()
+ then:
+ def response = contractVerifierMessaging.receiveMessage('activemq:output')
+ response.headers.get('BOOK-NAME') == 'foo'
+ and:
+ DocumentContext parsedJson = JsonPath.parse(contractVerifierObjectMapper.writeValueAsString(response.payload))
+ JsonAssertion.assertThat(parsedJson).field('bookName').isEqualTo('foo')
+ }
+
+ def "should generate tests triggered by a message"() {
+ given:
+ def dsl = Contract.make {
+ label 'some_label'
+ input {
+ messageFrom('jms:input')
+ messageBody([
+ bookName: 'foo'
+ ])
+ messageHeaders {
+ header('sample', 'header')
+ header('Content-Type', 'application/json')
+ }
+ }
+ outputMessage {
+ sentTo('jms:output')
+ body([
+ bookName: 'foo'
+ ])
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+ }
+
+ // generated test should look like this:
+
+ //given:
+ ContractVerifierMessage inputMessage = contractVerifierMessaging.create(
+ contractVerifierObjectMapper.writeValueAsString([bookName: 'foo']),
+ [sample: 'header']
+ )
+ when:
+ contractVerifierMessaging.send(inputMessage, 'jms:input')
+ then:
+ def response = contractVerifierMessaging.receiveMessage('jms:output')
+ response.headers.get('BOOK-NAME') == 'foo'
+ and:
+ DocumentContext parsedJson = JsonPath.parse(contractVerifierObjectMapper.writeValueAsString(response.payload))
+ JsonAssertion.assertThat(parsedJson).field('bookName').isEqualTo('foo')
+ }
+
+ def "should generate tests without destination, triggered by a message"() {
+ given:
+ def dsl = Contract.make {
+ label 'some_label'
+ input {
+ messageFrom('jms:delete')
+ messageBody([
+ bookName: 'foo'
+ ])
+ messageHeaders {
+ header('sample', 'header')
+ }
+ assertThat('bookWasDeleted()')
+ }
+ }
+
+ // generated test should look like this:
+
+ //given:
+ ContractVerifierMessage inputMessage = contractVerifierMessaging.create(
+ contractVerifierObjectMapper.writeValueAsString([bookName: 'foo']),
+ [sample: 'header']
+ )
+ when:
+ contractVerifierMessaging.send(inputMessage, 'jms:delete')
+ then:
+ noExceptionThrown()
+ bookWasDeleted()
+ }
+
+ // BASE CLASS WOULD HAVE THIS:
+
+ @Autowired ModelCamelContext camelContext
+ @Autowired BookDeleter bookDeleter
+
+ void bookReturnedTriggered() {
+ camelContext.createProducerTemplate().sendBody('direct:start', '''{"bookName" : "foo" }''')
+ }
+
+ PollingConditions pollingConditions = new PollingConditions()
+
+ void bookWasDeleted() {
+ pollingConditions.eventually {
+ assert bookDeleter.bookSuccessfulyDeleted.get()
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/build.gradle b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/build.gradle
new file mode 100644
index 0000000000..21eeaff00b
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/build.gradle
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+String verifier = "spring-cloud-contract-verifier"
+
+dependencies {
+ compile project(":$verifier-root:$verifier-core")
+ compile "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}"
+ compile "org.springframework.boot:spring-boot-starter-integration:${springBootVersion}"
+
+ testCompile project(":$verifier-root:$verifier-messaging-root:$verifier-integration")
+ testCompile "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
+ testCompile('org.spockframework:spock-spring:1.0-groovy-2.4') {
+ exclude(group: 'org.codehaus.groovy')
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy
new file mode 100644
index 0000000000..e43c21c9d2
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import com.fasterxml.jackson.annotation.JsonCreator
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class BookDeleted {
+ final String bookName
+
+ @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
+ BookDeleted(String bookName) {
+ this.bookName = bookName
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy
new file mode 100644
index 0000000000..e0041a8dcb
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.springframework.messaging.Message
+import org.springframework.messaging.MessageHeaders
+import org.springframework.messaging.support.MessageBuilder
+
+import java.util.concurrent.atomic.AtomicBoolean
+
+@CompileStatic
+@Slf4j
+class BookListener {
+
+ /**
+ Scenario for "should generate tests triggered by a message":
+ client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
+ server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
+ */
+ Message returnBook(BookReturned bookReturned) {
+ log.info("Returning book [$bookReturned]")
+ return MessageBuilder.createMessage(bookReturned, new MessageHeaders([
+ 'BOOK-NAME': bookReturned.bookName as Object
+ ]))
+ }
+
+ /**
+ Scenario for "should generate tests triggered by a message":
+ client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
+ server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
+ */
+ void bookDeleted(BookDeleted bookDeleted) {
+ log.info("Deleting book [$bookDeleted]")
+ bookSuccessfulyDeleted.set(true)
+ }
+
+ AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false)
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy
new file mode 100644
index 0000000000..130c19d468
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import com.fasterxml.jackson.annotation.JsonCreator
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class BookReturned {
+ final String bookName
+
+ @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
+ BookReturned(String bookName) {
+ this.bookName = bookName
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy
new file mode 100644
index 0000000000..888df79bce
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.beans.factory.annotation.Qualifier
+import org.springframework.messaging.MessageChannel
+import org.springframework.messaging.MessageHeaders
+import org.springframework.messaging.support.MessageBuilder
+import org.springframework.stereotype.Service
+
+@Service
+@CompileStatic
+@Slf4j
+class BookService {
+
+ @Autowired @Qualifier("outputChannel") MessageChannel outputChannel
+
+ /**
+ Scenario for "should generate tests triggered by a method":
+ client side: must have a possibility to "trigger" sending of a message to the given messageFrom
+ server side: will run the method and await upon receiving message on the output messageFrom
+
+ Method triggers sending a message to a source
+ */
+ void returnBook(BookReturned bookReturned) {
+ log.info("Returning book [$bookReturned]")
+ outputChannel.send(MessageBuilder.createMessage(bookReturned, new MessageHeaders([
+ 'BOOK-NAME': bookReturned.bookName as Object
+ ])))
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplication.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplication.groovy
new file mode 100644
index 0000000000..811fcbdfc3
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplication.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import org.springframework.boot.SpringApplication
+import org.springframework.boot.autoconfigure.SpringBootApplication
+import org.springframework.context.annotation.ImportResource
+
+@SpringBootApplication
+@ImportResource("classpath*:integration-context.xml")
+class IntegrationMessagingApplication {
+
+ static void main(String[] args) {
+ SpringApplication.run(IntegrationMessagingApplication.class, args)
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/resources/integration-context.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/resources/integration-context.xml
new file mode 100644
index 0000000000..3dd916e22f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/main/resources/integration-context.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/test/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplicationSpec.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/test/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplicationSpec.groovy
new file mode 100644
index 0000000000..68eaf5009b
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-integration/src/test/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplicationSpec.groovy
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import com.jayway.jsonpath.DocumentContext
+import com.jayway.jsonpath.JsonPath
+import com.toomuchcoding.jsonassert.JsonAssertion
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.test.SpringApplicationContextLoader
+import org.springframework.cloud.contract.spec.Contract
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessage
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessaging
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierObjectMapper
+import org.springframework.test.context.ContextConfiguration
+import spock.lang.Specification
+
+import javax.inject.Inject
+// Context configuration would end up in base class
+@ContextConfiguration(classes = [IntegrationMessagingApplication], loader = SpringApplicationContextLoader)
+public class IntegrationMessagingApplicationSpec extends Specification {
+
+ // ALL CASES
+ @Inject ContractVerifierMessaging contractVerifierMessaging
+ ContractVerifierObjectMapper contractVerifierObjectMapper = new ContractVerifierObjectMapper()
+
+ def "should work for triggered based messaging"() {
+ given:
+ // tag::method_trigger[]
+ def dsl = Contract.make {
+ // Human readable description
+ description 'Some description'
+ // Label by means of which the output message can be triggered
+ label 'some_label'
+ // input to the contract
+ input {
+ // the contract will be triggered by a method
+ triggeredBy('bookReturnedTriggered()')
+ }
+ // output message of the contract
+ outputMessage {
+ // destination to which the output message will be sent
+ sentTo('output')
+ // the body of the output message
+ body('''{ "bookName" : "foo" }''')
+ // the headers of the output message
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+ }
+ // end::method_trigger[]
+ // generated test should look like this:
+ when:
+ bookReturnedTriggered()
+ then:
+ def response = contractVerifierMessaging.receiveMessage('output')
+ response.headers.get('BOOK-NAME') == 'foo'
+ and:
+ DocumentContext parsedJson = JsonPath.parse(contractVerifierObjectMapper.writeValueAsString(response.payload))
+ JsonAssertion.assertThat(parsedJson).field('bookName').isEqualTo('foo')
+ }
+
+ def "should generate tests triggered by a message"() {
+ given:
+ // tag::message_trigger[]
+ def dsl = Contract.make {
+ description 'Some Description'
+ label 'some_label'
+ // input is a message
+ input {
+ // the message was received from this destination
+ messageFrom('input')
+ // has the following body
+ messageBody([
+ bookName: 'foo'
+ ])
+ // and the following headers
+ messageHeaders {
+ header('sample', 'header')
+ }
+ }
+ outputMessage {
+ sentTo('output')
+ body([
+ bookName: 'foo'
+ ])
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+ }
+ // end::message_trigger[]
+
+ // generated test should look like this:
+
+ //given:
+ ContractVerifierMessage inputMessage = contractVerifierMessaging.create(
+ contractVerifierObjectMapper.writeValueAsString([bookName: 'foo']),
+ [sample: 'header']
+ )
+ when:
+ contractVerifierMessaging.send(inputMessage, 'input')
+ then:
+ def response = contractVerifierMessaging.receiveMessage('output')
+ response.headers.get('BOOK-NAME') == 'foo'
+ and:
+ DocumentContext parsedJson = JsonPath.parse(contractVerifierObjectMapper.writeValueAsString(response.payload))
+ JsonAssertion.assertThat(parsedJson).field('bookName').isEqualTo('foo')
+ }
+
+ def "should generate tests without destination, triggered by a message"() {
+ given:
+ def dsl = Contract.make {
+ label 'some_label'
+ input {
+ messageFrom('delete')
+ messageBody([
+ bookName: 'foo'
+ ])
+ messageHeaders {
+ header('sample', 'header')
+ }
+ assertThat('bookWasDeleted()')
+ }
+ }
+
+ // generated test should look like this:
+
+ //given:
+ ContractVerifierMessage inputMessage = contractVerifierMessaging.create(
+ contractVerifierObjectMapper.writeValueAsString([bookName: 'foo']),
+ [sample: 'header']
+ )
+ when:
+ contractVerifierMessaging.send(inputMessage, 'delete')
+ then:
+ noExceptionThrown()
+ bookWasDeleted()
+ }
+
+ // BASE CLASS WOULD HAVE THIS:
+
+ @Autowired BookService bookService
+ @Autowired BookListener bookListener
+
+ void bookReturnedTriggered() {
+ bookService.returnBook(new BookReturned("foo"))
+ }
+
+ void bookWasDeleted() {
+ assert bookListener.bookSuccessfulyDeleted.get()
+ }
+
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/build.gradle b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/build.gradle
new file mode 100644
index 0000000000..dcc70f5e6e
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/build.gradle
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+repositories {
+ mavenLocal()
+ jcenter()
+ maven {
+ url "http://repo.spring.io/snapshot"
+ }
+ maven {
+ url "http://repo.spring.io/milestone"
+ }
+}
+
+String verifier = "spring-cloud-contract-verifier"
+
+dependencies {
+ compile project(":$verifier-root:$verifier-core")
+ compile "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}"
+ compile "org.springframework:spring-jms:${springVersion}"
+
+ compile 'org.apache.activemq:activemq-broker:5.12.1'
+ compile 'org.apache.activemq:activemq-pool:5.12.1'
+
+ testCompile project(":$verifier-root:$verifier-messaging-root:$verifier-messaging-core")
+ testCompile "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
+ testCompile('org.spockframework:spock-spring:1.0-groovy-2.4') {
+ exclude(group: 'org.codehaus.groovy')
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookDeleted.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookDeleted.groovy
new file mode 100644
index 0000000000..3ee03c12ec
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookDeleted.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring
+
+import com.fasterxml.jackson.annotation.JsonCreator
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class BookDeleted implements Serializable {
+ final String bookName
+
+ @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
+ BookDeleted(String bookName) {
+ this.bookName = bookName
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookListener.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookListener.groovy
new file mode 100644
index 0000000000..117bf6a9b6
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookListener.groovy
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.jms.annotation.JmsListener
+import org.springframework.jms.core.JmsTemplate
+import org.springframework.jms.core.MessageCreator
+import org.springframework.stereotype.Service
+
+import javax.jms.JMSException
+import javax.jms.Message
+import javax.jms.Session
+import java.util.concurrent.atomic.AtomicBoolean
+
+@CompileStatic
+@Slf4j
+@Service
+class BookListener {
+
+ @Autowired JmsTemplate jmsTemplate
+ ObjectMapper objectMapper = new ObjectMapper()
+
+ /**
+ Scenario for "should generate tests triggered by a message":
+ client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
+ server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
+ */
+ @JmsListener(destination = "input")
+ void returnBook(String messageAsString) {
+ BookReturned bookReturned = objectMapper.readerFor(BookReturned).readValue(messageAsString) as BookReturned
+ log.info("Returning book [$bookReturned]")
+ MessageCreator messageCreator = new MessageCreator() {
+ @Override
+ public Message createMessage(Session session) throws JMSException {
+ Message message = session.createObjectMessage(bookReturned);
+ message.setStringProperty('BOOK-NAME', bookReturned.bookName)
+ return message
+ }
+ };
+ jmsTemplate.send('output', messageCreator)
+ }
+
+ /**
+ Scenario for "should generate tests triggered by a message":
+ client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
+ server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
+ */
+ @JmsListener(destination = "delete")
+ void bookDeleted(String bookDeletedAsString) {
+ BookDeleted bookDeleted = objectMapper.readerFor(BookDeleted).readValue(bookDeletedAsString) as BookDeleted
+ log.info("Deleting book [$bookDeleted]")
+ bookSuccessfulyDeleted.set(true)
+ }
+
+ AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false)
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookReturned.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookReturned.groovy
new file mode 100644
index 0000000000..a875572a76
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookReturned.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring
+
+import com.fasterxml.jackson.annotation.JsonCreator
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class BookReturned implements Serializable {
+ String bookName
+
+ @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
+ BookReturned(String bookName) {
+ this.bookName = bookName
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookService.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookService.groovy
new file mode 100644
index 0000000000..b6413c21c4
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookService.groovy
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.jms.core.JmsTemplate
+import org.springframework.jms.core.MessageCreator
+import org.springframework.stereotype.Service
+
+import javax.jms.JMSException
+import javax.jms.Message
+import javax.jms.Session
+
+@Service
+@CompileStatic
+@Slf4j
+class BookService {
+
+ @Autowired JmsTemplate jmsTemplate
+
+ /**
+ Scenario for "should generate tests triggered by a method":
+ client side: must have a possibility to "trigger" sending of a message to the given messageFrom
+ server side: will run the method and await upon receiving message on the output messageFrom
+
+ Method triggers sending a message to a source
+ */
+ void returnBook(BookReturned bookReturned ) {
+ log.info("Returning book [$bookReturned]")
+ MessageCreator messageCreator = new MessageCreator() {
+ @Override
+ public Message createMessage(Session session) throws JMSException {
+ Message message = session.createObjectMessage(bookReturned);
+ message.setStringProperty('BOOK-NAME', bookReturned.bookName)
+ return message
+ }
+ };
+ jmsTemplate.send('output', messageCreator)
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/SpringMessagingApplication.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/SpringMessagingApplication.groovy
new file mode 100644
index 0000000000..c4a6676fb8
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/SpringMessagingApplication.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring
+
+import org.springframework.boot.SpringApplication
+import org.springframework.boot.autoconfigure.SpringBootApplication
+import org.springframework.jms.annotation.EnableJms
+
+@SpringBootApplication
+@EnableJms
+class SpringMessagingApplication {
+
+ static void main(String[] args) {
+ SpringApplication.run(SpringMessagingApplication.class, args)
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/SpringApplicationSpec.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/SpringApplicationSpec.groovy
new file mode 100644
index 0000000000..082cf2f2fc
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/SpringApplicationSpec.groovy
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring
+
+import com.jayway.jsonpath.DocumentContext
+import com.jayway.jsonpath.JsonPath
+import com.toomuchcoding.jsonassert.JsonAssertion
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.test.SpringApplicationContextLoader
+import org.springframework.cloud.contract.spec.Contract
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessage
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessaging
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierObjectMapper
+import org.springframework.test.context.ContextConfiguration
+import spock.lang.Specification
+import spock.util.concurrent.PollingConditions
+
+import javax.inject.Inject
+/**
+ * SPIKE ON TESTS FROM NOTES IN MessagingSpec
+ */
+// Context configuration would end up in base class
+@ContextConfiguration(classes = [SpringMessagingApplication], loader = SpringApplicationContextLoader)
+public class SpringApplicationSpec extends Specification {
+
+ // ALL CASES
+ @Inject ContractVerifierMessaging contractVerifierMessaging
+ ContractVerifierObjectMapper contractVerifierObjectMapper = new ContractVerifierObjectMapper()
+
+ def "should work for triggered based messaging"() {
+ given:
+ def dsl = Contract.make {
+ label 'some_label'
+ input {
+ triggeredBy('bookReturnedTriggered()')
+ }
+ outputMessage {
+ sentTo('output')
+ body('''{ "bookName" : "foo" }''')
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+ }
+ // generated test should look like this:
+ when:
+ bookReturnedTriggered()
+ then:
+ def response = contractVerifierMessaging.receiveMessage('output')
+ response.headers.get('BOOK-NAME') == 'foo'
+ and:
+ DocumentContext parsedJson = JsonPath.parse(contractVerifierObjectMapper.writeValueAsString(response.payload))
+ JsonAssertion.assertThat(parsedJson).field('bookName').isEqualTo('foo')
+ }
+
+ def "should generate tests triggered by a message"() {
+ given:
+ def dsl = Contract.make {
+ label 'some_label'
+ input {
+ messageFrom('input')
+ messageBody([
+ bookName: 'foo'
+ ])
+ messageHeaders {
+ header('sample', 'header')
+ }
+ }
+ outputMessage {
+ sentTo('output')
+ body([
+ bookName: 'foo'
+ ])
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+ }
+
+ // generated test should look like this:
+
+ //given:
+ ContractVerifierMessage inputMessage = contractVerifierMessaging.create(
+ contractVerifierObjectMapper.writeValueAsString([bookName: 'foo']),
+ [sample: 'header']
+ )
+ when:
+ contractVerifierMessaging.send(inputMessage, 'input')
+ then:
+ def response = contractVerifierMessaging.receiveMessage('output')
+ response.headers.get('BOOK-NAME') == 'foo'
+ and:
+ DocumentContext parsedJson = JsonPath.parse(contractVerifierObjectMapper.writeValueAsString(response.payload))
+ JsonAssertion.assertThat(parsedJson).field('bookName').isEqualTo('foo')
+ }
+
+ def "should generate tests without destination, triggered by a message"() {
+ given:
+ def dsl = Contract.make {
+ label 'some_label'
+ input {
+ messageFrom('delete')
+ messageBody([
+ bookName: 'foo'
+ ])
+ messageHeaders {
+ header('sample', 'header')
+ }
+ assertThat('bookWasDeleted()')
+ }
+ }
+
+ // generated test should look like this:
+
+ //given:
+ ContractVerifierMessage inputMessage = contractVerifierMessaging.create(
+ contractVerifierObjectMapper.writeValueAsString([bookName: 'foo']),
+ [sample: 'header']
+ )
+ when:
+ contractVerifierMessaging.send(inputMessage, 'delete')
+ then:
+ noExceptionThrown()
+ bookWasDeleted()
+ }
+
+ // BASE CLASS WOULD HAVE THIS:
+
+ @Autowired BookService bookService
+ @Autowired BookListener bookListener
+
+ void bookReturnedTriggered() {
+ bookService.returnBook(new BookReturned("foo"))
+ }
+
+ PollingConditions pollingConditions = new PollingConditions()
+
+ void bookWasDeleted() {
+ pollingConditions.eventually {
+ assert bookListener.bookSuccessfulyDeleted.get()
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/ContractVerifierSpringMessageBuilder.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/ContractVerifierSpringMessageBuilder.groovy
new file mode 100644
index 0000000000..fdd0094caf
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/ContractVerifierSpringMessageBuilder.groovy
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring.config
+
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessage
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessageBuilder
+import org.springframework.jms.core.MessageCreator
+
+import javax.jms.JMSException
+import javax.jms.Message
+import javax.jms.Session
+/**
+ * @author Marcin Grzejszczak
+ */
+public class ContractVerifierSpringMessageBuilder implements ContractVerifierMessageBuilder {
+
+ @Override
+ public ContractVerifierMessage create(final T payload, final Map headers) {
+ MessageCreator messageCreator = new MessageCreator() {
+ @Override
+ public Message createMessage(Session session) throws JMSException {
+ Message message = session.createObjectMessage(payload);
+ headers.entrySet().each { Map.Entry entry ->
+ message.setObjectProperty(entry.key, entry.value)
+ }
+ return message
+ }
+ };
+
+ return new SpringMessage<>(messageCreator)
+ }
+
+ @Override
+ public ContractVerifierMessage create(Message message) {
+ return new SpringMessage<>(message);
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/ContractVerifierSpringMessaging.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/ContractVerifierSpringMessaging.groovy
new file mode 100644
index 0000000000..bd7e93503b
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/ContractVerifierSpringMessaging.groovy
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring.config
+
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessage
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessageBuilder
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessaging
+import org.springframework.jms.core.JmsTemplate
+import org.springframework.stereotype.Component
+
+import javax.jms.Message
+import java.util.concurrent.TimeUnit
+/**
+ * @author Marcin Grzejszczak
+ */
+@Component
+public class ContractVerifierSpringMessaging implements ContractVerifierMessaging {
+
+ private static final Logger log = LoggerFactory.getLogger(ContractVerifierSpringMessaging.class);
+
+ private final JmsTemplate jmsTemplate;
+ private final ContractVerifierMessageBuilder builder;
+
+ @Autowired
+ @SuppressWarnings("unchecked")
+ public ContractVerifierSpringMessaging(ContractVerifierMessageBuilder builder, JmsTemplate jmsTemplate) {
+ this.builder = builder
+ this.jmsTemplate = jmsTemplate
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void send(T payload, Map headers, String destination) {
+ send(builder.create(payload, headers), destination);
+ }
+
+ @Override
+ public void send(ContractVerifierMessage message, String destination) {
+ try {
+ jmsTemplate.send(destination, ((SpringMessage) message).messageCreator)
+ } catch (Exception e) {
+ log.error("Exception occurred while trying to send a message [" + message + "] " +
+ "to a channel with name [" + destination + "]", e);
+ throw e;
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ContractVerifierMessage receiveMessage(String destination, long timeout, TimeUnit timeUnit) {
+ try {
+ return builder.create(jmsTemplate.receive(destination));
+ } catch (Exception e) {
+ log.error("Exception occurred while trying to read a message from " +
+ " a channel with name [" + destination + "]", e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public ContractVerifierMessage receiveMessage(String destination) {
+ return receiveMessage(destination, 5, TimeUnit.SECONDS);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ContractVerifierMessage create(T t, Map headers) {
+ return builder.create(t, headers);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ContractVerifierMessage create(Message message) {
+ return builder.create(message);
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/ManualContractVerifierConfiguration.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/ManualContractVerifierConfiguration.groovy
new file mode 100644
index 0000000000..eb9966e3b3
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/ManualContractVerifierConfiguration.groovy
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring.config
+
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessaging
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.jms.core.JmsTemplate
+
+/**
+ * @author Marcin Grzejszczak
+ */
+@Configuration
+class ManualContractVerifierConfiguration {
+
+ @Bean
+ ContractVerifierMessaging contractVerifierMessaging(JmsTemplate jmsTemplate) {
+ return new ContractVerifierSpringMessaging(new ContractVerifierSpringMessageBuilder(), jmsTemplate);
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/SpringMessage.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/SpringMessage.groovy
new file mode 100644
index 0000000000..28239443a1
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-spring/src/test/groovy/org/springframework/cloud/contract/verifier/samples/spring/config/SpringMessage.groovy
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring.config
+
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessage
+import org.springframework.jms.core.MessageCreator
+
+import javax.jms.Message
+import javax.jms.ObjectMessage
+/**
+ * @author Marcin Grzejszczak
+ */
+public class SpringMessage implements ContractVerifierMessage {
+
+ private final ObjectMessage messageDelegate;
+ final MessageCreator messageCreator;
+
+ public SpringMessage(Message messageDelegate) {
+ this.messageDelegate = (ObjectMessage) messageDelegate;
+ this.messageCreator = null
+ }
+
+ public SpringMessage(MessageCreator messageCreator) {
+ this.messageDelegate = null;
+ this.messageCreator = messageCreator
+ }
+
+ @Override
+ public T getPayload() {
+ return messageDelegate.getObject();
+ }
+
+ @Override
+ public Map getHeaders() {
+ Map headers = [:]
+ def enumeration = messageDelegate.propertyNames
+ while(enumeration.hasMoreElements()) {
+ String propertyName = enumeration.nextElement()
+ headers << [(propertyName) : messageDelegate.getObjectProperty(propertyName)]
+ }
+ return headers
+ }
+
+ @Override
+ Object getHeader(String key) {
+ return getHeaders().get(key)
+ }
+
+ @Override
+ public Message convert() {
+ return messageDelegate;
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/build.gradle b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/build.gradle
new file mode 100644
index 0000000000..296798e705
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/build.gradle
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+repositories {
+ mavenLocal()
+ jcenter()
+ maven {
+ url "http://repo.spring.io/snapshot"
+ }
+ maven {
+ url "http://repo.spring.io/milestone"
+ }
+}
+
+String verifier = "spring-cloud-contract-verifier"
+
+dependencies {
+ compile project(":$verifier-root:$verifier-core")
+ compile "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}"
+ compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit:${springStreamVersion}"
+
+ testCompile project(":$verifier-root:$verifier-messaging-root:$verifier-stream")
+ testCompile "org.springframework.cloud:spring-cloud-stream-test-support:${springStreamVersion}"
+ testCompile('org.spockframework:spock-spring:1.0-groovy-2.4') {
+ exclude(group: 'org.codehaus.groovy')
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy
new file mode 100644
index 0000000000..e43c21c9d2
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import com.fasterxml.jackson.annotation.JsonCreator
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class BookDeleted {
+ final String bookName
+
+ @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
+ BookDeleted(String bookName) {
+ this.bookName = bookName
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy
new file mode 100644
index 0000000000..6e70889df4
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.cloud.stream.annotation.EnableBinding
+import org.springframework.cloud.stream.annotation.StreamListener
+import org.springframework.cloud.stream.messaging.Sink
+import org.springframework.cloud.stream.messaging.Source
+import org.springframework.messaging.MessageHeaders
+import org.springframework.messaging.support.MessageBuilder
+
+import java.util.concurrent.atomic.AtomicBoolean
+
+@CompileStatic
+@Slf4j
+@EnableBinding([DeleteSink, Sink])
+class BookListener {
+
+ @Autowired Source source
+
+ /**
+ Scenario for "should generate tests triggered by a message":
+ client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
+ server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
+ */
+ @StreamListener(Sink.INPUT)
+ void returnBook(BookReturned bookReturned) {
+ log.info("Returning book [$bookReturned]")
+ source.output().send(MessageBuilder.createMessage(bookReturned, new MessageHeaders([
+ 'BOOK-NAME': bookReturned.bookName as Object
+ ])))
+ }
+
+ /**
+ Scenario for "should generate tests triggered by a message":
+ client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
+ server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
+ */
+ @StreamListener(DeleteSink.INPUT)
+ void bookDeleted(BookDeleted bookDeleted) {
+ log.info("Deleting book [$bookDeleted]")
+ // ... doing some work
+ bookSuccessfulyDeleted.set(true)
+ }
+
+ AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false)
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy
new file mode 100644
index 0000000000..130c19d468
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import com.fasterxml.jackson.annotation.JsonCreator
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class BookReturned {
+ final String bookName
+
+ @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
+ BookReturned(String bookName) {
+ this.bookName = bookName
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy
new file mode 100644
index 0000000000..4e8a8adefa
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.cloud.stream.messaging.Source
+import org.springframework.messaging.MessageHeaders
+import org.springframework.messaging.support.MessageBuilder
+import org.springframework.stereotype.Service
+
+@Service
+@CompileStatic
+@Slf4j
+class BookService {
+
+ private final Source source
+
+ @Autowired
+ BookService(Source source) {
+ this.source = source
+ }
+
+ /**
+ Scenario for "should generate tests triggered by a method":
+ client side: must have a possibility to "trigger" sending of a message to the given messageFrom
+ server side: will run the method and await upon receiving message on the output messageFrom
+
+ Method triggers sending a message to a source
+ */
+ void returnBook(BookReturned bookReturned) {
+ log.info("Returning book [$bookReturned]")
+ source.output().send(MessageBuilder.createMessage(bookReturned, new MessageHeaders([
+ 'BOOK-NAME': bookReturned.bookName as Object
+ ])))
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/DeleteSink.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/DeleteSink.groovy
new file mode 100644
index 0000000000..aa6e72e4e4
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/DeleteSink.groovy
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import org.springframework.cloud.stream.annotation.Input
+import org.springframework.cloud.stream.messaging.Sink
+import org.springframework.messaging.SubscribableChannel
+
+/**
+ * @author Marcin Grzejszczak
+ */
+interface DeleteSink extends Sink {
+
+ String INPUT = "delete";
+
+ @Input(DeleteSink.INPUT)
+ SubscribableChannel delete();
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplication.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplication.groovy
new file mode 100644
index 0000000000..9fa8eb8f86
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplication.groovy
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.stream.annotation.EnableBinding
+import org.springframework.cloud.stream.messaging.Sink;
+import org.springframework.cloud.stream.messaging.Source;
+
+@SpringBootApplication
+@EnableBinding([Source, Sink])
+class StreamMessagingApplication {
+
+ static void main(String[] args) {
+ SpringApplication.run(StreamMessagingApplication.class, args)
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/resources/application.yml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/resources/application.yml
new file mode 100644
index 0000000000..1ff1cf7519
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/main/resources/application.yml
@@ -0,0 +1,2 @@
+spring.cloud.stream.bindings.input.destination: inputDestination
+spring.cloud.stream.bindings.output.destination: sentTo
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/test/groovy/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplicationSpec.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/test/groovy/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplicationSpec.groovy
new file mode 100644
index 0000000000..1a21561554
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/samples/samples-messaging-stream/src/test/groovy/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplicationSpec.groovy
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging
+
+import com.jayway.jsonpath.DocumentContext
+import com.jayway.jsonpath.JsonPath
+import com.toomuchcoding.jsonassert.JsonAssertion
+import org.springframework.cloud.contract.spec.Contract
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessage
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.test.SpringApplicationContextLoader
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierMessaging
+import org.springframework.cloud.contract.verifier.messaging.ContractVerifierObjectMapper
+import org.springframework.test.context.ContextConfiguration
+import spock.lang.Specification
+
+import javax.inject.Inject
+/**
+ * SPIKE ON TESTS FROM NOTES IN MessagingSpec
+ */
+// Context configuration would end up in base class
+@ContextConfiguration(classes = [StreamMessagingApplication], loader = SpringApplicationContextLoader)
+public class StreamMessagingApplicationSpec extends Specification {
+
+ // ALL CASES
+ @Inject ContractVerifierMessaging contractVerifierMessaging
+ ContractVerifierObjectMapper contractVerifierObjectMapper = new ContractVerifierObjectMapper()
+
+ def "should work for triggered based messaging"() {
+ given:
+ def dsl = Contract.make {
+ label 'some_label'
+ input {
+ triggeredBy('bookReturnedTriggered()')
+ }
+ outputMessage {
+ sentTo('output')
+ body('''{ "bookName" : "foo" }''')
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+ }
+ // generated test should look like this:
+ when:
+ bookReturnedTriggered()
+ then:
+ def response = contractVerifierMessaging.receiveMessage('output')
+ response.headers.get('BOOK-NAME') == 'foo'
+ and:
+ DocumentContext parsedJson = JsonPath.parse(contractVerifierObjectMapper.writeValueAsString(response.payload))
+ JsonAssertion.assertThat(parsedJson).field('bookName').isEqualTo('foo')
+ }
+
+ def "should generate tests triggered by a message"() {
+ given:
+ def dsl = Contract.make {
+ label 'some_label'
+ input {
+ messageFrom('input')
+ messageBody([
+ bookName: 'foo'
+ ])
+ messageHeaders {
+ header('sample', 'header')
+ }
+ }
+ outputMessage {
+ sentTo('output')
+ body([
+ bookName: 'foo'
+ ])
+ headers {
+ header('BOOK-NAME', 'foo')
+ }
+ }
+ }
+
+ // generated test should look like this:
+
+ //given:
+ ContractVerifierMessage inputMessage = contractVerifierMessaging.create(
+ contractVerifierObjectMapper.writeValueAsString([bookName: 'foo']),
+ [sample: 'header']
+ )
+ when:
+ contractVerifierMessaging.send(inputMessage, 'input')
+ then:
+ def response = contractVerifierMessaging.receiveMessage('output')
+ response.headers.get('BOOK-NAME') == 'foo'
+ and:
+ DocumentContext parsedJson = JsonPath.parse(contractVerifierObjectMapper.writeValueAsString(response.payload))
+ JsonAssertion.assertThat(parsedJson).field('bookName').isEqualTo('foo')
+ }
+
+ def "should generate tests without destination, triggered by a message"() {
+ given:
+ def dsl = Contract.make {
+ label 'some_label'
+ input {
+ messageFrom('delete')
+ messageBody([
+ bookName: 'foo'
+ ])
+ messageHeaders {
+ header('sample', 'header')
+ }
+ assertThat('bookWasDeleted()')
+ }
+ }
+
+ // generated test should look like this:
+
+ //given:
+ ContractVerifierMessage inputMessage = contractVerifierMessaging.create(
+ contractVerifierObjectMapper.writeValueAsString([bookName: 'foo']),
+ [sample: 'header']
+ )
+ when:
+ contractVerifierMessaging.send(inputMessage, 'delete')
+ then:
+ noExceptionThrown()
+ bookWasDeleted()
+ }
+
+ // BASE CLASS WOULD HAVE THIS:
+
+ @Autowired BookService bookService
+ @Autowired BookListener bookListener
+
+ void bookReturnedTriggered() {
+ bookService.returnBook(new BookReturned("foo"))
+ }
+
+ void bookWasDeleted() {
+ assert bookListener.bookSuccessfulyDeleted.get()
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/scripts/runTests.sh b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/scripts/runTests.sh
new file mode 100755
index 0000000000..4eb0cf6494
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/scripts/runTests.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+set -o errexit
+
+ROOT_FOLDER=`pwd`
+echo "Current folder is $ROOT_FOLDER"
+
+mkdir -p build
+CONTRACT_VERIFIER_VERSION=1.0.0.BUILD-SNAPSHOT
+export CONTRACT_VERIFIER_VERSION=${CONTRACT_VERIFIER_VERSION}
+
+echo "Current Spring Cloud Contract Verifier version is ${CONTRACT_VERIFIER_VERSION}"
+
+cd build
+echo "Cloning samples"
+git clone https://github.com/Codearte/accurest-samples
+cd accurest-samples
+
+echo "Running Gradle tests"
+. ./runTests.sh
+
+echo "Running Maven tests"
+. ./runMavenTests.sh
+
+cd $ROOT_FOLDER
\ No newline at end of file
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/settings.gradle b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/settings.gradle
new file mode 100644
index 0000000000..bb28620d0c
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/settings.gradle
@@ -0,0 +1,39 @@
+String verifier = "spring-cloud-contract-verifier"
+String stubRunner = "spring-cloud-contract-stub-runner"
+
+rootProject.name = "$verifier-parent"
+
+include "docs"
+
+include ":spring-cloud-contract-spec"
+
+include ":$verifier:$verifier-core",
+ ":$verifier:$verifier-gradle-plugin",
+ ":$verifier:$verifier-converters",
+ ":$verifier:$verifier-testing-utils"
+
+include ":$verifier:$verifier-messaging:$verifier-messaging-core",
+ ":$verifier:$verifier-messaging:$verifier-integration",
+ ":$verifier:$verifier-messaging:$verifier-stream",
+ ":$verifier:$verifier-messaging:$verifier-camel"
+
+include ":$stubRunner:$stubRunner",
+ ":$stubRunner:$stubRunner-spring",
+ ":$stubRunner:$stubRunner-boot",
+ ":$stubRunner:$stubRunner-spring-cloud",
+ ":$stubRunner:$stubRunner-junit"
+
+include ":$stubRunner:$stubRunner-messaging:$stubRunner-integration",
+ ":$stubRunner:$stubRunner-messaging:$stubRunner-stream",
+ ":$stubRunner:$stubRunner-messaging:$stubRunner-camel"
+
+include ":samples:samples-messaging-stream",
+ ":samples:samples-messaging-integration",
+ ":samples:samples-messaging-camel",
+ ":samples:samples-messaging-spring"
+
+//to prevent StackOverflow in Sonar
+project(":$verifier").name = "$verifier-root"
+project(":$stubRunner").name = "$stubRunner-root"
+project(":$verifier:$verifier-messaging").name = "$verifier-messaging-root"
+project(":$stubRunner:$stubRunner-messaging").name = "$stubRunner-messaging-root"
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/Contract.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/Contract.groovy
new file mode 100644
index 0000000000..7e424d019d
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/Contract.groovy
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.spec
+
+import groovy.transform.EqualsAndHashCode
+import groovy.transform.ToString
+import groovy.transform.TypeChecked
+import org.springframework.cloud.contract.spec.internal.Input
+import org.springframework.cloud.contract.spec.internal.OutputMessage
+import org.springframework.cloud.contract.spec.internal.Request
+import org.springframework.cloud.contract.spec.internal.Response
+
+/**
+ * The point of entry to the DSL
+ *
+ * @since 1.0.0
+ */
+@TypeChecked
+@EqualsAndHashCode
+@ToString(includeFields = true, includePackage = false, includeNames = true)
+class Contract {
+
+ Integer priority
+ Request request
+ Response response
+ String label
+ String description
+ Input input
+ OutputMessage outputMessage
+
+ protected Contract() {}
+
+ /**
+ * Factory method to create the DSL
+ */
+ static Contract make(Closure closure) {
+ Contract dsl = new Contract()
+ closure.delegate = dsl
+ closure()
+ return dsl
+ }
+
+ void priority(int priority) {
+ this.priority = priority
+ }
+
+ void label(String label) {
+ this.label = label
+ }
+
+ void description(String description) {
+ this.description = description
+ }
+
+ void request(@DelegatesTo(Request) Closure closure) {
+ this.request = new Request()
+ closure.delegate = request
+ closure()
+ }
+
+ void response(@DelegatesTo(Response) Closure closure) {
+ this.response = new Response()
+ closure.delegate = response
+ closure()
+ }
+
+ void input(@DelegatesTo(Input) Closure closure) {
+ this.input = new Input()
+ closure.delegate = input
+ closure()
+ }
+
+ void outputMessage(@DelegatesTo(OutputMessage) Closure closure) {
+ this.outputMessage = new OutputMessage()
+ closure.delegate = outputMessage
+ closure()
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/ContractVerifierException.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/ContractVerifierException.groovy
new file mode 100644
index 0000000000..2750320176
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/ContractVerifierException.groovy
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.spec
+
+import groovy.transform.CompileStatic
+
+/**
+ * @author Jakub Kubrynski, codearte.io
+ */
+@CompileStatic
+class ContractVerifierException extends RuntimeException {
+
+ ContractVerifierException(String message) {
+ super(message)
+ }
+
+ ContractVerifierException(String message, Throwable cause) {
+ super(message, cause)
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Body.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Body.groovy
new file mode 100644
index 0000000000..38e42ad8ba
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Body.groovy
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.spec.internal
+
+import groovy.transform.CompileStatic
+import groovy.transform.EqualsAndHashCode
+import groovy.transform.ToString
+
+/**
+ * Represents a body of a request / response or a message
+ *
+ * @since 1.0.0
+ */
+@ToString(includePackage = false, includeFields = true, includeNames = true)
+@EqualsAndHashCode(includeFields = true)
+@CompileStatic
+class Body extends DslProperty {
+
+ Body(Map body) {
+ super(extractValue(body, { DslProperty p -> p.clientValue}), extractValue(body, {DslProperty p -> p.serverValue}))
+ }
+
+ private static Map extractValue(Map body, Closure valueProvider) {
+ body.collectEntries { Map.Entry entry ->
+ [(entry.key): valueProvider(entry.value)]
+ } as Map
+ }
+
+ Body(List bodyAsList) {
+ super(bodyAsList.collect { DslProperty p -> p.clientValue }, bodyAsList.collect { DslProperty p -> p.serverValue })
+ }
+
+ Body(Object bodyAsValue) {
+ this("${bodyAsValue}")
+ }
+
+ Body(GString bodyAsValue) {
+ super(bodyAsValue, bodyAsValue)
+ }
+
+ Body(DslProperty bodyAsValue) {
+ super(bodyAsValue.clientValue, bodyAsValue.serverValue)
+ }
+
+ Body(MatchingStrategy matchingStrategy) {
+ super(matchingStrategy, matchingStrategy)
+ }
+
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/ClientDslProperty.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/ClientDslProperty.groovy
new file mode 100644
index 0000000000..e16afaffb5
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/ClientDslProperty.groovy
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.spec.internal
+
+import groovy.transform.CompileStatic
+
+/**
+ * Represents a client side {@link DslProperty}
+ *
+ * @since 1.0.0
+ */
+@CompileStatic
+class ClientDslProperty extends DslProperty {
+
+ ClientDslProperty(Object singleValue) {
+ super(singleValue)
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Common.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Common.groovy
new file mode 100644
index 0000000000..6cbf2a3a6f
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Common.groovy
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.spec.internal
+
+import groovy.transform.PackageScope
+import groovy.transform.TypeChecked
+
+import java.util.regex.Pattern
+
+/**
+ * Contains useful common methods for the DSL.
+ *
+ * @TypeChecked instead of @CompileStatic due to usage of double dispatch.
+ * Double dispatch doesn't work if you're using @CompileStatic
+ *
+ * @since 1.0.0
+ */
+@TypeChecked
+@PackageScope
+class Common {
+
+ @Delegate private final RegexPatterns regexPatterns = new RegexPatterns()
+
+ Map convertObjectsToDslProperties(Map body) {
+ return body.collectEntries {
+ Map.Entry entry ->
+ [(entry.key): toDslProperty(entry.value)]
+ } as Map
+ }
+
+ Collection convertObjectsToDslProperties(List body) {
+ return (body.collect {
+ Object element -> toDslProperty(element)
+ } as List)
+ }
+
+ DslProperty toDslProperty(Object property) {
+ return new DslProperty(property)
+ }
+
+ DslProperty toDslProperty(Map property) {
+ return new DslProperty(property.collectEntries {
+ [(it.key): toDslProperty(it.value)]
+ })
+ }
+
+ DslProperty toDslProperty(List property) {
+ return new DslProperty(property.collect {
+ toDslProperty(it)
+ })
+ }
+
+ DslProperty toDslProperty(DslProperty property) {
+ return property
+ }
+
+ NamedProperty named(DslProperty name, DslProperty value){
+ return new NamedProperty(name, value)
+ }
+
+ NamedProperty named(Map namedMap){
+ return new NamedProperty(namedMap)
+ }
+
+ DslProperty value(ClientDslProperty client, ServerDslProperty server) {
+ assertThatSidesMatch(client.clientValue, server.serverValue)
+ return new DslProperty(client.clientValue, server.serverValue)
+ }
+
+ DslProperty value(Object value) {
+ return new DslProperty(value)
+ }
+
+ DslProperty value(ServerDslProperty server, ClientDslProperty client) {
+ assertThatSidesMatch(client.clientValue, server.serverValue)
+ return new DslProperty(client.clientValue, server.serverValue)
+ }
+
+ DslProperty $(ClientDslProperty client, ServerDslProperty server) {
+ return value(client, server)
+ }
+
+ DslProperty $(ServerDslProperty server, ClientDslProperty client) {
+ return value(server, client)
+ }
+
+ Pattern regex(String regex) {
+ return Pattern.compile(regex)
+ }
+
+ OptionalProperty optional(Object object) {
+ return new OptionalProperty(object)
+ }
+
+ ExecutionProperty execute(String commandToExecute) {
+ return new ExecutionProperty(commandToExecute)
+ }
+
+ ClientDslProperty client(Object clientValue) {
+ return new ClientDslProperty(clientValue)
+ }
+
+ ClientDslProperty stub(Object clientValue) {
+ return new ClientDslProperty(clientValue)
+ }
+
+ ServerDslProperty server(Object serverValue) {
+ return new ServerDslProperty(serverValue)
+ }
+
+ ServerDslProperty test(Object serverValue) {
+ return new ServerDslProperty(serverValue)
+ }
+
+ void assertThatSidesMatch(OptionalProperty stubSide, Object testSide) {
+ assert testSide ==~ Pattern.compile(stubSide.optionalPattern())
+ }
+
+ void assertThatSidesMatch(Pattern pattern, String value) {
+ assert value ==~ pattern
+ }
+
+ void assertThatSidesMatch(String value, Pattern pattern) {
+ assert value ==~ pattern
+ }
+
+ void assertThatSidesMatch(MatchingStrategy firstSide, MatchingStrategy secondSide) {
+ if (firstSide.type == MatchingStrategy.Type.ABSENT && secondSide != MatchingStrategy.Type.ABSENT) {
+ throwAbsentError()
+ }
+ }
+
+ void assertThatSidesMatch(MatchingStrategy firstSide, Object secondSide) {
+ if (firstSide.type == MatchingStrategy.Type.ABSENT) {
+ throwAbsentError()
+ }
+ }
+
+ void assertThatSidesMatch(Object firstSide, MatchingStrategy secondSide) {
+ if (secondSide.type == MatchingStrategy.Type.ABSENT) {
+ throwAbsentError()
+ }
+ }
+
+ private void throwAbsentError() {
+ throw new IllegalStateException("Absent cannot only be used only on one side")
+ }
+
+ void assertThatSidesMatch(Object firstSide, Object secondSide) {
+ // do nothing
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/DslProperty.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/DslProperty.groovy
new file mode 100644
index 0000000000..4be6c853ae
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/DslProperty.groovy
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.spec.internal
+
+import groovy.transform.CompileStatic
+import groovy.transform.EqualsAndHashCode
+import groovy.transform.ToString
+
+/**
+ * Represents an element of a DSL that can contain client or sever side values
+ *
+ * @since 1.0.0
+ */
+@CompileStatic
+@EqualsAndHashCode(includeFields = true)
+@ToString(includePackage = false, includeNames = true)
+class DslProperty {
+
+ final T clientValue
+ final T serverValue
+
+ DslProperty(T clientValue, T serverValue) {
+ this.clientValue = clientValue
+ this.serverValue = serverValue
+ }
+
+ DslProperty(T singleValue) {
+ this.clientValue = singleValue
+ this.serverValue = singleValue
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/ExecutionProperty.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/ExecutionProperty.groovy
new file mode 100644
index 0000000000..6f79e6dbcf
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/ExecutionProperty.groovy
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.spec.internal
+
+import groovy.transform.CompileStatic
+
+/**
+ * Represents a property that will become an executable method in the
+ * generated tests
+ *
+ * @since 1.0.0
+ */
+@CompileStatic
+class ExecutionProperty {
+
+ private static final String PLACEHOLDER_VALUE = '\\$it'
+
+ final String executionCommand
+
+ ExecutionProperty(String executionCommand) {
+ this.executionCommand = executionCommand
+ }
+
+ /**
+ * Inserts the provided code as a parameter to the method and returns
+ * the code that represents that method execution
+ */
+ String insertValue(String valueToInsert) {
+ return executionCommand.replaceAll(PLACEHOLDER_VALUE, valueToInsert)
+ }
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Header.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Header.groovy
new file mode 100644
index 0000000000..9989d875b4
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Header.groovy
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.spec.internal
+import groovy.transform.CompileStatic
+import groovy.transform.EqualsAndHashCode
+import groovy.transform.ToString
+
+/**
+ * Represents a header of a request / response or a message
+ *
+ * @since 1.0.0
+ */
+@EqualsAndHashCode(includeFields = true)
+@ToString(includePackage = false, includeFields = true, ignoreNulls = true, includeNames = true)
+@CompileStatic
+class Header extends DslProperty {
+
+ String name
+
+ Header(String name, DslProperty dslProperty) {
+ super(dslProperty.clientValue, dslProperty.serverValue)
+ this.name = name
+ }
+
+ Header(String name, Object value) {
+ super(value)
+ this.name = name
+ }
+
+}
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Headers.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Headers.groovy
new file mode 100644
index 0000000000..036a23598e
--- /dev/null
+++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Headers.groovy
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.spec.internal
+
+import groovy.transform.EqualsAndHashCode
+import groovy.transform.ToString
+import groovy.transform.TypeChecked
+
+/**
+ * Represents a set of headers of a request / response or a message
+ *
+ * @since 1.0.0
+ */
+@EqualsAndHashCode(includeFields = true)
+@ToString(includePackage = false, includeFields = true, ignoreNulls = true, includeNames = true)
+@TypeChecked
+class Headers {
+
+ Set entries = []
+
+ void header(Map singleHeader) {
+ Map.Entry first = singleHeader.entrySet().first()
+ entries << new Header(first?.key, first?.value)
+ }
+
+ void header(String headerKey, Object headerValue) {
+ entries << new Header(headerKey, headerValue)
+ }
+
+ void executeForEachHeader(Closure closure) {
+ entries?.each {
+ header -> closure(header)
+ }
+ }
+
+ /**
+ * Converts the headers into their stub side representations and returns as
+ * a map of String key => Object value.
+ */
+ Map asStubSideMap() {
+ def acc = [:].withDefault { [] as Collection