Skip to content

Latest commit

 

History

History
162 lines (108 loc) · 6.76 KB

README.md

File metadata and controls

162 lines (108 loc) · 6.76 KB

Prerequisites

The workshop requires that you download some applications to be able to complete the tasks on the day. You should do these tasks before the workshop as some of the files are large.

The tasks that will be the following

  • Download Java SDK
  • Install one of the following IDE's, Intellij/Eclipse, IntelliJ is recommended
  • Download the baseline project for the labs

Downloading Java SDK

Install and IDE

The next stage is to install an IDE

IntelliJ - Recommended

#f03c15 It is worth noting that Gradle 6 has been released and does not work well with older version of Intellij. To avoid any problems please upgrade to the latest

  • Visit https://www.jetbrains.com/idea/download/#section=mac
  • Select the Ultimate or Community Edition and download. Ultimate has a 30 day trial which is nice to use if you have a free trial available. Community Edition is missing a few features from Ultimate but none that matter for this workshop and is completely free
    • Windows - Run the downloaded EXE file
    • Mac - Run the downloaded PKG file
  • Configure the SDK
    • Open intelliJ and select File -> Project Structure
    • Notice the No SDK which can be seen in the image Setup the SDK
    • Select New -> JDK
    • Navigate to your installed Java SDK
      • Windows - c:\Program Files\AdoptOpenJDK\version-downloaded
      • Mac - /Library/Java/JavaVirtualMachines/version-downloaded/Contents/Home

Eclipse

  • Visit https://www.eclipse.org/downloads/packages/
  • Find the "Eclipse IDE for Java Developers" and download the version for you operating system Eclipse download
    • Windows - Unzip the downloaded zip folder and run the eclipse.exe file
    • Mac - Open the DMG file and eclipse will install

Baseline project for the labs

In order to save time during the workshop it would useful for you to download the baseline SpringBoot project and cache some of dependencies that will be needed for the labs.

Download SpringBoot project

The following URL is pre-configured to take you directly to https://start.spring.io and set the required dependencies to Spring Web and Spring Contract Verifier. Open your browser and enter the URL, and then click on "Generate" to download a zip file containing the project.

https://start.spring.io/#!type=gradle-project&language=java&platformVersion=2.7.0&packaging=jar&jvmVersion=11&groupId=com.jpgough&artifactId=apiworkshop&name=apiworkshop&description=Starter%20api%20workshop%20project&packageName=com.jpgough.apiworkshop&dependencies=web,cloud-contract-verifier

Unzip the downloaded archive to a location on your file system.

Temporary Build Instructions

Whilst testing the setup of this lab I have found a bug in Spring Initializr. To fix this issue, you will need to replace the following in the build.gradle:

tasks.named('contracts') {
	testFramework = org.springframework.cloud.contract.verifier.config.TestFramework.JUNIT5
	failOnNoContracts = false
}

with

contracts {
	testFramework = org.springframework.cloud.contract.verifier.config.TestFramework.JUNIT5
}

Import project into you IDE

Import the project into IntelliJ by opening the the build.gradle file as a project.

Intellij Project Import

On hitting OK the project will most likely download the internet (or at least all the required dependencies). Once this has completed your baseline project is ready. You can try running the tests to verify that your project builds and the context loads correctly.

Eclipse

File -> Import -> Gradle -> Existing Gradle Project. Follow the wizard to bring in the project and resolve the dependencies.

Eclipse Project Import

Verify it works

You will need to make some changes to the build.gradle file to allow it to work from the beginning. The setup for Spring Cloud Contracts which will be discussed in 02-contracts needs a little change.

In the build.gradle file overwrite the small sction called contracts to the following:

contracts {
  testFramework = org.springframework.cloud.contract.verifier.config.TestFramework.JUNIT5
  failOnNoContracts = false
}

Now simply run gradlew test from the command line to verify that the base project works as expected.

Optional

The following additional installations allow you to complete all the workshop extension tasks. You do not have to install them to complete the core of this workshop.

A REST client

We will be making requests to the services we build so it is really useful to have a rest client. Please use any of the suggested options:

  • In IntelliJ there is one available in Tools -> HTTP Client -> Test RESTful Web Service
  • For Windows or Mac POSTman
  • For chrome restlet client

Docker

We next need to install Docker. First it is necessary to create a Docker account.

  • To create a Docker account visit the following website and register: https://hub.docker.com/signup

  • Next depending on your system you will need to choose the Docker version to install

    • For Windows 10 Home Edition you will need to install the legacy Docker Toolbox. The instructions can be found here and are indepth so should be followed carefully

    • For Mac or any other Windows Edition Visit https://hub.docker.com/?overlay=onboarding

      • Follow the first step to download Docker for your operating system
      • Run the downloaded file
        • Windows run the EXE file
        • Mac run the DMG file
      • If you wish continue with the rest of the docker guide, however, it is not important

Docker images

As part of the workshop we will require the downloading of some docker images. These can be quite large so to save time it may be simpler to download these now

  • Open a cli
    • Windows - Powershell
    • Mac - terminal
  • Execute the following commands
docker pull postgres:latest
docker pull dius/pact-broker:latest
docker pull jpgough/api-workshop-gateway
docker pull gradle:jdk11