GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - spring-cloud-samples/spring-cloud-contract-samples: Samples for Spring Cloud Contract project

BranchesTags
Open more actions menu

Latest commit

 

History

918 Commits
918 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.mvn/wrapper
.mvn/wrapper
 
 
beer_contracts
beer_contracts
 
 
common
common
 
 
consumer
consumer
 
 
consumer_camel
consumer_camel
 
 
consumer_grpc
consumer_grpc
 
 
consumer_java
consumer_java
 
 
consumer_jms_middleware
consumer_jms_middleware
 
 
consumer_kafka_middleware
consumer_kafka_middleware
 
 
consumer_kotlin
consumer_kotlin
 
 
consumer_kotlin_ftw
consumer_kotlin_ftw
 
 
consumer_proto
consumer_proto
 
 
consumer_rabbit_middleware
consumer_rabbit_middleware
 
 
consumer_security
consumer_security
 
 
consumer_with_discovery
consumer_with_discovery
 
 
consumer_with_latest_2_2_features
consumer_with_latest_2_2_features
 
 
consumer_with_latest_3_0_features_gradle
consumer_with_latest_3_0_features_gradle
 
 
consumer_with_restdocs
consumer_with_restdocs
 
 
consumer_with_secured_webflux
consumer_with_secured_webflux
 
 
consumer_with_stubs_per_consumer
consumer_with_stubs_per_consumer
 
 
contract_empty_git
contract_empty_git
 
 
contract_git
contract_git
 
 
docs
docs
 
 
gradle
gradle
 
 
producer
producer
 
 
producer_advanced
producer_advanced
 
 
producer_camel
producer_camel
 
 
producer_graphql
producer_graphql
 
 
producer_grpc
producer_grpc
 
 
producer_java
producer_java
 
 
producer_jaxrs
producer_jaxrs
 
 
producer_jaxrs_spring
producer_jaxrs_spring
 
 
producer_jms_middleware
producer_jms_middleware
 
 
producer_kafka_middleware
producer_kafka_middleware
 
 
producer_kotlin
producer_kotlin
 
 
producer_kotlin_ftw
producer_kotlin_ftw
 
 
producer_proto
producer_proto
 
 
producer_rabbit_middleware
producer_rabbit_middleware
 
 
producer_router_function
producer_router_function
 
 
producer_security
producer_security
 
 
producer_testng
producer_testng
 
 
producer_webflux
producer_webflux
 
 
producer_webflux_security
producer_webflux_security
 
 
producer_webflux_webtestclient
producer_webflux_webtestclient
 
 
producer_with_dsl_restdocs
producer_with_dsl_restdocs
 
 
producer_with_empty_git
producer_with_empty_git
 
 
producer_with_external_contracts
producer_with_external_contracts
 
 
producer_with_git
producer_with_git
 
 
producer_with_latest_2_2_features
producer_with_latest_2_2_features
 
 
producer_with_restdocs
producer_with_restdocs
 
 
producer_with_spock
producer_with_spock
 
 
producer_with_stubs_per_consumer
producer_with_stubs_per_consumer
 
 
producer_with_webtestclient_restdocs
producer_with_webtestclient_restdocs
 
 
producer_with_xml
producer_with_xml
 
 
producer_yaml
producer_yaml
 
 
scripts
scripts
 
 
standalone
standalone
 
 
wiremock-for-contract-docs
wiremock-for-contract-docs
 
 
wiremock-tomcat
wiremock-tomcat
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.springformat
.springformat
 
 
LICENSE.txt
LICENSE.txt
 
 
README.adoc
README.adoc
 
 
build.gradle
build.gradle
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
mvnw
mvnw
 
 
mvnw.cmd
mvnw.cmd
 
 
pom.xml
pom.xml
 
 

Repository files navigation

CircleCI

Spring Cloud Contract samples

This repository contains the consumer and the producer applications to use with Spring Cloud Contract project.

It contains several important branches. master where we test against the latest versions of Spring Cloud Contract, and x.x.x where we test against x.x.x version of Spring Cloud Contract.

This repository shows examples of

  • storing contracts on the producer side

  • storing contracts in a common repo

  • passing stubs via Rest docs

Both for REST and Messaging. Built with Maven and Gradle. Also some additional Spring Cloud Contract plugin configuration is present.

These samples were used in the following presentation. It might help to use the samples.

  • SlideShare / YouTube

You can also go through the Spring Cloud Contract Workshops to learn how to use the tool by example.

Projects

Common

Contains the JAR with common classes used in the contracts on the producer side.

Beer_contracts

Contains the repo with all contracts for all applications. It can be used when you want to store all contracts in a single place.

Producer

The producer application contains contracts for both REST and messaging communication. From these contracts tests and stubs will be generated.

The producer in the contract also uses features like usage of common libraries, different combination of dynamic properties.

It also uses scenario based contracts. That means that the produced stubs are stateful.

Producer_yaml

The same as Producer but uses YAML

Producer_advanced

Contains more advanced examples of Spring Cloud Contract usage.

Producer_with_external_contracts

The producer application that downloads its contracts for both REST and messaging communication, from the Beer-contracts JAR. From these contracts tests and stubs will be generated.

Producer_with_restdocs

The producer application that uses both contracts and Spring Cloud Contract WireMock with RESTDocs. Contracts are used for messaging but the HTTP stubs are created via REST Docs tests.

Producer_with_stubs_per_consumer

The producer application stores the contracts in such way that every consumer has its own, delegated folder. Then on the consumer side by turning on the stubs per consumer feature only respective stubs for the given consumer will be used.

Producer_with_latest_2_2_features

The producer application using the latest, most notable features of Spring Cloud Contract 2.2

Producer_kotlin

The producer application with code in Kotlin

Producer_kotlin_ftw

(FTW - For the win) The producer application with code, setup and contract in Kotlin.

Consumer_kotlin_ftw

(FTW - For the win) The consumer application with code, setup and contract in Kotlin.

Consumer

The consumer application is using the stubs of the producer for both rest and messaging.

It also contains the consumer side of the stateful scenario case. By calling the same endpoint a couple of times we get different responses due to changing state.

Consumer_with_discovery

The consumer application is using the stubs of the producer for rest. It sends requests via a load balanced rest template. In the tests Spring Cloud Contract stubs out any discovery service infrastructure.

Consumer_with_restdocs

The consumer application is using the stubs of the producer for both rest and messaging. The stubs come from the test compile dependency of the producer.

Consumer_with_stubs_per_consumer

The consumer application that has the stub of the HTTP server get fed with stubs that lay under proper folder in the reused JAR.

Producer_proto

Project that uses Protocol Buffers to communicate.

Consumer_proto

Project that uses Protocol Buffers to communicate.

How to build it?

You can run Maven from the root folder once the "common" module has been installed. So from a clean checkout:

(cd common; ../mvnw clean install)
./mvnw clean install -Ptest

(or ./scripts/runMavenBuild.sh). Then you can build normally

./mvnw clean install

The order should be as follows

  • common

  • beer-contracts

  • producer

  • producer_advanced

  • producer_with_external_contracts

  • producer_with_stubs_per_consumer

  • consumer

  • consumer_with_discovery

  • producer_with_restdocs

  • consumer_with_restdocs

  • consumer_with_stubs_per_consumer

If the order is different then your apps will blow up most likely due to missing stubs.

You can also go to each of the projects and run Gradle wrapper:

./gradlew clean build publishToMavenLocal

How to test it?

You can run the script

./scripts/runAcceptanceTests.sh

About

Samples for Spring Cloud Contract project

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

395 stars

Watchers

19 watching

Forks

311 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.