Getting Started

Install Prerequisites

Start your installations before the presentation begins so that the dependencies are able to download before we start the workshop.

Install docker :

  • Mac: https://docs.docker.com/docker-for-mac/install/

  • Window: https://docs.docker.com/docker-for-windows/install/

  • Linux: https://docs.docker.com/install/linux/docker-ce/ubuntu/

Pull docker images:

$ docker pull springcloud/spring-cloud-contract:2.1.1.RELEASE
$ docker pull springcloud/spring-cloud-contract-stub-runner:2.1.1.RELEASE

Install Node: https://nodejs.org/en/

Clone Repos:

$ git clone https://github.com/angularkc/contract-driven-development.git
$ git clone https://github.com/wkorando/produce-contracts.git

Client-Side Developers

From the root of contract-driven-development run the following:

$ npm install

Server-Side Developers

From the root of contract-driven-development run the following:

$ cd produce-service
$ ./mvnw package

Currently the contract of addProduce.yml is always sending the same response, ignoring the contents of the request the client is sending. Spring Cloud Contract can allow contracts to be more dynamic, for example allow fields within the response to pull from the request. Let's update addProduce.yml to do this.

Update POST contract to respond with request body

Every service is going to be composed of many different contracts. Defining how an API should respond to a given request. It's important that we not only define what happens for successful responses, but unsuccessful ones as well. Currently we have a contract findProduceByName.yml that defines what happens when a client successful searches for a subset of produce. Let's write a contract for when a client sends an invalid search request that has special characters in it.

Last updated