Skip to content

Sample application to demonstrate the use of Producer-driven Contract and Consumer Driven Contract tests with SpringBoot 2.3.0 + Spring Cloud Contract 2.2 - Server / Rest API provider / contract producer sample application

Notifications You must be signed in to change notification settings

bovino/spring_cloud_contract_server_api_sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Producer-driven Contract and Consumer-Driven Contract tests Sample - Server / REST API Provider / contract producer application

Sample application to demonstrate the use of Producer-driven Contract and Consumer Driven Contract tests with SpringBoot 2.3.0 + Spring Cloud Contract 2.2 - Server / REST API provider / contract producer sample.

This application uses:

  • Spring Boot 2.3.0
  • Spring Cloud Hoxton.SR4
  • Spring Cloud Contract 2.2
  • Spring Web+Rest
  • Lombok
  • Java 8
  • Gradle (Gradle wrapper)
  • JUnit 5 e Mockito

You can see the client API application here: https://github.com/bovino/spring_cloud_contract_client_api_sample

TODO List for this sample project

  • Adding Docker and maybe Kubernetes support
  • Adding continuos integration with Jenkins (or similars)
  • Adding code validation with SonarQube (or similars)
  • Adding more contract sample with others DSLs instead of only Groovy (Yaml, Java and Kotlin)
  • Implement a Consumer-driven sample using an Angular application + Pact
  • using a remote StubRunner instead of a local one
  • publishing the contracts to a Git repository instead of using Maven local repo
  • adding a video-tutorial showing all the steps from the beginning, starting with the generation of the codebase from Spring Initializer
  • Do you have other ideas for improvements? Please tell me! Reach out to me on Linkedin: https://www.linkedin.com/in/bovino/

Getting Started

This application uses Gradle (Gradle wrapper) and a few useful commands are:

  • Basic Build: gradlew clean build
  • Publish (includes generation and publish of contract stubs for your local maven repository): gradlew clean publishToMavenLocal
  • Run tests (including the contract tests): gradlew clean test

Before using this application you will need:

  • Some IDE with Lombok support (i like IntelliJ)
  • Any Rest API client (i like Postman)
  • JDK 1.8,0_251 or newer
  • Configure your JAVA_HOME environment variable
  • You need the ports 8080 (server API), 8081 (client API) and 8082 (local StubRunner) to be free

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use and setup some features more concretely:

Additional Links

These additional references should also help you:

About

Sample application to demonstrate the use of Producer-driven Contract and Consumer Driven Contract tests with SpringBoot 2.3.0 + Spring Cloud Contract 2.2 - Server / Rest API provider / contract producer sample application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published