Skip to content

Commit cc270a7

Browse files
authored
chore: step1 update (#25)
1 parent 2d73240 commit cc270a7

File tree

7 files changed

+80
-9
lines changed

7 files changed

+80
-9
lines changed

.github/workflows/test.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- step1
6+
pull_request:
7+
branches:
8+
- step1
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: 17
21+
distribution: 'temurin'
22+
23+
- name: Test consumer tests
24+
run: ./gradlew consumer:bootRun || true

.gitignore

+39
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,41 @@ out/
2929
/nbdist/
3030
/.nb-gradle/
3131

32+
### VS Code ###
33+
.vscode/
34+
.gradle
35+
build/
36+
!../gradle/wrapper/gradle-wrapper.jar
37+
!**/src/main/**/build/
38+
!**/src/test/**/build/
39+
consumer/bin
40+
provider/bin
41+
42+
### STS ###
43+
.apt_generated
44+
.classpath
45+
.factorypath
46+
.project
47+
.settings
48+
.springBeans
49+
.sts4-cache
50+
51+
### IntelliJ IDEA ###
52+
.idea/
53+
*.iws
54+
*.iml
55+
*.ipr
56+
out/
57+
!**/src/main/**/out/
58+
!**/src/test/**/out/
59+
60+
### NetBeans ###
61+
/nbproject/private/
62+
/nbbuild/
63+
/dist/
64+
/nbdist/
65+
/.nb-gradle/
66+
3267
### VS Code ###
3368
.vscode/
3469
.gradle
@@ -45,3 +80,7 @@ gradle-app.setting
4580

4681
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
4782
# gradle/wrapper/gradle-wrapper.properties
83+
84+
## MacOS
85+
86+
.DS_Store

.java-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
17.0

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ step of the workshop just check out the branch for that step (i.e. `git checkout
77

88
## Requirements
99

10-
* JDK 8+
10+
* JDK 17+
1111
* Docker for step 11
1212

1313
## Workshop outline:

consumer/build.gradle

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
plugins {
2-
id 'org.springframework.boot' version '2.3.4.RELEASE'
3-
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
2+
// Stopped from moving to 3.2.x due to wiremock issue
3+
// https://github.com/wiremock/wiremock/issues/2395
4+
id 'org.springframework.boot' version '3.1.8'
5+
id 'io.spring.dependency-management' version '1.1.4'
46
}
57

68
group = 'au.com.dius.pactworkshop'
79
version = '0.0.1-SNAPSHOT'
8-
sourceCompatibility = '8'
10+
sourceCompatibility = '17'
911

1012
dependencies {
1113
implementation 'org.springframework.boot:spring-boot-starter'
@@ -14,7 +16,7 @@ dependencies {
1416
testImplementation('org.springframework.boot:spring-boot-starter-test') {
1517
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
1618
}
17-
testImplementation 'com.github.tomakehurst:wiremock:2.27.2'
19+
testImplementation 'com.github.tomakehurst:wiremock:3.0.1'
1820
}
1921

2022
test {

consumer/src/main/java/au/com/dius/pactworkshop/consumer/ConsoleInterface.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,15 @@ private Integer getUserChoice(Scanner scanner) {
4949

5050
private void printProduct(int index) {
5151
String id = products.get(index - 1).getId();
52-
Product product = productService.getProduct(id);
52+
try {
53+
Product product = productService.getProduct(id);
5354

54-
System.out.println("Product Details\n---------------");
55-
System.out.println(product);
55+
System.out.println("Product Details\n---------------");
56+
System.out.println(product);
57+
} catch (Exception e) {
58+
System.out.println("Failed to load product " + id);
59+
System.out.println(e.getMessage());
60+
}
5661
}
5762

5863
private Integer parseChoice(String choice) {
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)