Skip to content

Commit 5c518fe

Browse files
committed
Update demo to latest microcks-testcontainers version and enhance README
Signed-off-by: Laurent Broudoux <[email protected]>
1 parent a5fe243 commit 5c518fe

File tree

6 files changed

+45
-35
lines changed

6 files changed

+45
-35
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: maven
4+
directory: /
5+
schedule:
6+
interval: daily
7+
8+
- package-ecosystem: github-actions
9+
directory: /
10+
schedule:
11+
interval: daily

assets/order-service-ecosystem.png

17.5 KB
Loading

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<dependency>
6262
<groupId>io.github.microcks</groupId>
6363
<artifactId>microcks-testcontainers</artifactId>
64-
<version>0.2.5</version>
64+
<version>0.2.6</version>
6565
<scope>test</scope>
6666
</dependency>
6767
<dependency>

src/test/java/org/acme/order/ContainersConfiguration.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ KafkaContainer kafkaContainer() {
3131

3232
@Bean
3333
MicrocksContainersEnsemble microcksEnsemble(DynamicPropertyRegistry registry) {
34-
/*
35-
DockerImageName nativeImage = DockerImageName.parse("quay.io/microcks/microcks-uber:nightly-native")
36-
.asCompatibleSubstituteFor("quay.io/microcks/microcks-uber:1.8.1");
37-
38-
MicrocksContainersEnsemble ensemble = new MicrocksContainersEnsemble(network, nativeImage)
39-
*/
34+
// Uncomment these lines (36-38) if you want to use the native image of Microcks
35+
// and comment the next MicrocksContainersEnsemble declaration line (40).
36+
// DockerImageName nativeImage = DockerImageName.parse("quay.io/microcks/microcks-uber:1.9.0-native")
37+
// .asCompatibleSubstituteFor("quay.io/microcks/microcks-uber:1.9.0");
38+
// MicrocksContainersEnsemble ensemble = new MicrocksContainersEnsemble(network, nativeImage)
4039

4140
MicrocksContainersEnsemble ensemble = new MicrocksContainersEnsemble(network, "quay.io/microcks/microcks-uber:1.9.0")
4241
.withPostman() // We need this to do contract-testing with Postman collection

step-1-getting-started.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,30 @@ We would recommend using [SDKMAN](https://sdkman.io/) to install Java on your ma
1313

1414
### Install Docker
1515

16-
You need to have a Docker environment to use Testcontainers.
16+
You need to have a [Docker](https://docs.docker.com/get-docker/) or [Podman](https://podman.io/) environment to use Testcontainers.
1717

1818
```shell
1919
$ docker version
2020

2121
Client:
22-
Cloud integration: v1.0.35
23-
Version: 24.0.2
24-
API version: 1.43
25-
Go version: go1.20.4
26-
Git commit: cb74dfc
27-
Built: Thu May 25 21:51:16 2023
22+
Cloud integration: v1.0.35+desktop.10
23+
Version: 25.0.3
24+
API version: 1.44
25+
Go version: go1.21.6
26+
Git commit: 4debf41
27+
Built: Tue Feb 6 21:13:26 2024
2828
OS/Arch: darwin/arm64
2929
Context: desktop-linux
3030

31-
Server: Docker Desktop 4.21.1 (114176)
31+
Server: Docker Desktop 4.27.2 (137060)
3232
Engine:
33-
Version: 24.0.2
34-
API version: 1.43 (minimum version 1.12)
35-
Go version: go1.20.4
36-
Git commit: 659604f
37-
Built: Thu May 25 21:50:59 2023
33+
Version: 25.0.3
34+
API version: 1.44 (minimum version 1.24)
35+
Go version: go1.21.6
36+
Git commit: f417435e5f6216828dec57958c490c4f8bae4f98
37+
Built: Wed Feb 7 00:39:16 2024
3838
OS/Arch: linux/arm64
3939
Experimental: false
40-
...
4140
```
4241

4342
## Download the project
@@ -53,7 +52,7 @@ git clone https://github.com/microcks/microcks-testcontainers-java-spring-demo.g
5352
With Maven:
5453

5554
```shell
56-
./mvnw compile
55+
./mvnw clean package -DskipTests
5756
```
5857

5958
###

step-2-exploring-the-app.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ but also relies on an existing API we have [introduced in a previous post](https
77
![Order Service ecosystem](./assets/order-service-ecosystem.png)
88

99
The `Order Service` application has been designed around 5 main components that are directly mapped on Spring Boot components and classes:
10-
* The `OrderController` (in package `org.acme.order.api`) is responsible for exposing an `Order API` to the outer world.
11-
* The `OrderService` (in package `org.acme.order.service`) is responsible for implementing the business logic around the creation of orders.
12-
* The `PastryAPIClient` (in package `org.acme.order.client`) is responsible for calling the `Pastry API` in *Product Domain* and get details or list of pastries.
13-
* The `OrderEventPublisher` (in package `org.acme.order.service`) is responsible for publishing a message on a `Kafka` topic when a new `Order` is created.
14-
* The `OrderEventListener` (in package `org.acme.order.service`) is responsible for consuming message on a `Kafka` topic when an `Order` has been reviewed.
10+
* The [`OrderController`](src/main/java/org/acme/order/api/OrderController.java) (in package `org.acme.order.api`) is responsible for exposing an `Order API` to the outer world.
11+
* The [`OrderService`](src/main/java/org/acme/order/service/OrderService.java) is responsible for implementing the business logic around the creation of orders.
12+
* The [`PastryAPIClient`](src/main/java/org/acme/order/client/PastryAPIClient.java) is responsible for calling the `Pastry API` in *Product Domain* and get details or list of pastries.
13+
* The [`OrderEventPublisher`](src/main/java/org/acme/order/service/OrderEventPublisher.java) is responsible for publishing a message on a `Kafka` topic when a new `Order` is created.
14+
* The [`OrderEventListener`](src/main/java/org/acme/order/service/OrderEventListener.java) is responsible for consuming message on a `Kafka` topic when an `Order` has been reviewed.
1515

1616
![Order Service architecture](./assets/order-service-architecture.png)
1717

@@ -21,23 +21,24 @@ dependencies (like a `Payment Service`, a `Customer Service`, a `Shipping Servic
2121

2222
However, this situation is complex enough to highlight the two problems we're addressing:
2323
1) How to **efficiently set up a development environment** that depends on third-party API like the Pastry API?
24-
You certainly want to avoid cloning this component repository, figuring out how to launch it and configure it accordingly. As a developer, developing your own mock of this service makes you also lose time and risk drifting from initial intent,
24+
- You certainly want to avoid cloning this component repository and trying to figure out how to launch and configure it accordingly.
25+
- As a developer, developing your own mock of this service makes you also lose time and risk drifting from initial intent,
2526
2) How to **efficiently validate the conformance** of the `Order API` and `Order Events` against business expectations and API contracts?
26-
Besides the core business logic, you might want to validate the network and protocol serialization layers as well as the respect of semantics.
27+
- Besides the core business logic, you might want to validate the network and protocol serialization layers as well as the respect of semantics.
2728

2829
## Business logic
2930

3031
This application must implement basic flows:
31-
* When creating a new `Order`, the service must check that the products are available before creating and persisting an order. Otherwise, order cannot be placed.
32-
* When the `Order` is actually created, the service must also publish an `OrderEvent` to a specific Kafka topic to propagate this information to other systems that will review the events,
33-
* When the `OrderEvent` has been reviewed, a new message is published on another `Kafka` topic. The `OrderEventListener` must capture-it and update the corresponding `Order` status using the service.
32+
* When creating a new [`Order`](src/main/java/org/acme/order/service/model/Order.java), the service must check that the products are available before creating and persisting an order. Otherwise, order cannot be placed.
33+
* When the [`Order`](src/main/java/org/acme/order/service/model/Order.java) is actually created, the service must also publish an [`OrderEvent`](src/main/java/org/acme/order/service/model/OrderEvent.java) to a specific Kafka topic to propagate this information to other systems that will review the events,
34+
* When the [`OrderEvent`](src/main/java/org/acme/order/service/model/OrderEvent.java) has been reviewed, a new message is published on another `Kafka` topic. The [`OrderEventListener`](src/main/java/org/acme/order/service/OrderEventListener.java) must capture-it and update the corresponding [`Order`](src/main/java/org/acme/order/service/model/Order.java) status using the service.
3435

3536
## Flows specifications
3637

3738
All the interactions are specified using API contracts:
38-
* The Order API is specified using the `src/main/resources/order-service-openapi.yaml` OpenAPI specification,
39-
* The Pastry API is specified using the `src/test/resources/third-parties/apipastries-openapi.yaml` OpenAPI specification,
40-
* The Order Events are specified using the `src/main/resources/order-events-asyncapi.yaml` AsyncAPI specification.
39+
* The Order API is specified using the [`order-service-openapi.yaml`](src/main/resources/order-service-openapi.yaml) OpenAPI specification,
40+
* The Pastry API is specified using the [`apipastries-openapi.yaml`](src/test/resources/third-parties/apipastries-openapi.yaml) OpenAPI specification,
41+
* The Order Events are specified using the [`order-events-asyncapi.yaml`](src/main/resources/order-events-asyncapi.yaml) AsyncAPI specification.
4142

4243
Those specifications will help us for two things:
4344
1) They will be used to provide simulations (or mocks) of third-parties systems - typically the Pastry API provider and the reviewer system that provides updates on `OrderEvents`

0 commit comments

Comments
 (0)