Skip to content

Commit c73330c

Browse files
committed
Spring,Dropwizard: Currency Exchange impl
1 parent 6374d09 commit c73330c

File tree

31 files changed

+321
-7
lines changed

31 files changed

+321
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
## Quick start
66
1. Build: `./gradlew clean build`
7-
2. Spin Up DB: `docker-compose -f docker-compose.yml up -d`
7+
2. Spin Up DB And Wiremock: `docker-compose -f docker-compose.yml up -d`
88
3. Start one App: `./run-dropwizard.sh` or `./run-spring.sh`
99
4. Run Gatling: `./gradlew :loadtest:gatlingRun`
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package bitxon.api.thirdparty.exchange.model;
2+
3+
import java.util.Map;
4+
5+
import lombok.AllArgsConstructor;
6+
import lombok.Builder;
7+
import lombok.Data;
8+
import lombok.NoArgsConstructor;
9+
10+
@Data
11+
@Builder
12+
@NoArgsConstructor
13+
@AllArgsConstructor
14+
public class ExchangeRate {
15+
16+
private String base;
17+
private Map<String, Double> rates;
18+
}

common-wiremock/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
group = 'bitxon'
6+
version = '1.0-SNAPSHOT'
7+
sourceCompatibility = '17'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"base": "EUR",
3+
"rates": {
4+
"USD": 1.0,
5+
"GBP": 0.5
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"base": "GBP",
3+
"rates": {
4+
"USD": 2.0,
5+
"EUR": 2.0
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"base": "USD",
3+
"rates": {
4+
"EUR": 1.0,
5+
"GBP": 0.5
6+
}
7+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"request": {
3+
"url": "/exchanges?currency=EUR",
4+
"method": "GET"
5+
},
6+
"response": {
7+
"status": 200,
8+
"bodyFileName": "base-eur-response.json",
9+
"headers": {
10+
"Content-Type": "application/json; charset=UTF-8"
11+
}
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"request": {
3+
"url": "/exchanges?currency=GBP",
4+
"method": "GET"
5+
},
6+
"response": {
7+
"status": 200,
8+
"bodyFileName": "base-gbp-response.json",
9+
"headers": {
10+
"Content-Type": "application/json; charset=UTF-8"
11+
}
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"request": {
3+
"url": "/exchanges?currency=USD",
4+
"method": "GET"
5+
},
6+
"response": {
7+
"status": 200,
8+
"bodyFileName": "base-usd-response.json",
9+
"headers": {
10+
"Content-Type": "application/json; charset=UTF-8"
11+
}
12+
}
13+
}

docker-compose.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,13 @@ services:
88
- POSTGRES_USER=postgres
99
- POSTGRES_PASSWORD=postgres
1010
ports:
11-
- '5432:5432'
11+
- '5432:5432'
12+
13+
wiremock:
14+
image: wiremock/wiremock:2.32.0
15+
ports:
16+
- "8888:8080"
17+
command:
18+
- "--global-response-templating"
19+
volumes:
20+
- ./common-wiremock/src/main/resources/stubs:/home/wiremock

0 commit comments

Comments
 (0)