From 481b3b92e6345238c0de8fa4fa07cb3621f1536f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luis=20Fernando=20Garci=CC=81a=20Q?=
<105936384+lglabs@users.noreply.github.com>
Date: Sat, 2 Nov 2024 22:36:24 +0100
Subject: [PATCH] [LG-64] - update docs for acceptance test module
- And remove liquibase migration on acceptance test module
---
.../src/main/resources/application.yml | 0
.../src/test/resources/application-test.yml | 2 +
.../db/changelog/db.changelog-master.yaml | 3 -
.../resources/db/changelog/ddl-v.0.0.1.yaml | 34 ---
blank-support/app/docs/atdd-module.md | 289 +++++++++++++++---
5 files changed, 254 insertions(+), 74 deletions(-)
delete mode 100644 blank-acceptance-test/src/main/resources/application.yml
delete mode 100644 blank-acceptance-test/src/test/resources/db/changelog/db.changelog-master.yaml
delete mode 100644 blank-acceptance-test/src/test/resources/db/changelog/ddl-v.0.0.1.yaml
diff --git a/blank-acceptance-test/src/main/resources/application.yml b/blank-acceptance-test/src/main/resources/application.yml
deleted file mode 100644
index e69de29..0000000
diff --git a/blank-acceptance-test/src/test/resources/application-test.yml b/blank-acceptance-test/src/test/resources/application-test.yml
index 0e4ba2a..8a72344 100644
--- a/blank-acceptance-test/src/test/resources/application-test.yml
+++ b/blank-acceptance-test/src/test/resources/application-test.yml
@@ -25,6 +25,8 @@ blanksystem:
spring:
datasource:
url: jdbc
+ liquibase:
+ enabled: false
logging:
level:
diff --git a/blank-acceptance-test/src/test/resources/db/changelog/db.changelog-master.yaml b/blank-acceptance-test/src/test/resources/db/changelog/db.changelog-master.yaml
deleted file mode 100644
index 64ac92c..0000000
--- a/blank-acceptance-test/src/test/resources/db/changelog/db.changelog-master.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-databaseChangeLog:
- - include:
- file: db/changelog/ddl-v.0.0.1.yaml
\ No newline at end of file
diff --git a/blank-acceptance-test/src/test/resources/db/changelog/ddl-v.0.0.1.yaml b/blank-acceptance-test/src/test/resources/db/changelog/ddl-v.0.0.1.yaml
deleted file mode 100644
index a184e15..0000000
--- a/blank-acceptance-test/src/test/resources/db/changelog/ddl-v.0.0.1.yaml
+++ /dev/null
@@ -1,34 +0,0 @@
-databaseChangeLog:
- - changeSet:
- id: 01_blank_create_schema
- author: lg
- changes:
- - sql:
- sql: "CREATE SCHEMA IF NOT EXISTS blank"
- - changeSet:
- id: 02_blank_create_blank_table
- author: lg
- changes:
- - createTable:
- schemaName: blank
- tableName: blank
- columns:
- - column:
- name: id
- type: UUID
- constraints:
- primaryKey: true
- nullable: false
- - column:
- name: name
- type: VARCHAR(50)
- constraints:
- nullable: true
- - column:
- name: insert_timestamp
- type: timestamp
- constraints:
- nullable: true
- - column:
- name: update_timestamp
- type: timestamp
\ No newline at end of file
diff --git a/blank-support/app/docs/atdd-module.md b/blank-support/app/docs/atdd-module.md
index d69b65f..ba56270 100644
--- a/blank-support/app/docs/atdd-module.md
+++ b/blank-support/app/docs/atdd-module.md
@@ -50,14 +50,15 @@ For more details, read more about [Hexagonal Architecture(Spanish)][2].
Dependencies:
> _Lg5 tries to simplify dependencies but the power is the same._ 👌
-```xml title="acceptance-test-module(pom.xml)" linenums="1" hl_lines="3"
+```xml title="acceptance-test-module(pom.xml)" linenums="1" hl_lines="4"
+
com.lg5.spring
- lg5-spring-integration-test
+ lg5-spring-acceptance-test
test
```
-It is recommended to create the following `boot/` directory on your test directory.
+It is recommended to create the following `boot/` directory on your `test` directory as `com.[blanksystem].[blank].service/boot`.
```markdown hl_lines="4"
└── test/
├── java/
@@ -73,63 +74,108 @@ To get started, you need to add the following classes:
=== "TestContainers Loader"
> Important the image name and use the correct version. For instance: `com.blanksystem/blank-service` with version `1.0.0-alpha`.
- ```java title="TestContainersLoader.java" linenums="1" hl_lines="32"
+ ```java title="TestContainersLoader.java" linenums="1" hl_lines="38"
+ import com.lg5.spring.kafka.config.data.KafkaConfigData;
+ import com.lg5.spring.testcontainer.config.AppContainerCustomConfig;
+ import com.lg5.spring.testcontainer.config.ContainerConfig;
import com.lg5.spring.testcontainer.config.KafkaContainerCustomConfig;
import com.lg5.spring.testcontainer.config.PostgresContainerCustomConfig;
- import com.lg5.spring.testcontainer.config.WireMockGuiContainerCustomConfig;
import com.lg5.spring.testcontainer.config.WiremockContainerCustomConfig;
import com.lg5.spring.testcontainer.container.AppCustomContainer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
- import org.testcontainers.containers.BindMode;
+ import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.wiremock.integrations.testcontainers.WireMockContainer;
+ import java.util.HashMap;
+ import java.util.List;
import java.util.Map;
-
- import static com.lg5.spring.testcontainer.config.DataBaseContainerCustomConfig.JDBC_URL_CUSTOM;
- import static com.lg5.spring.testcontainer.config.KafkaContainerCustomConfig.BOOTSTRAP_SERVERS_CUSTOM;
- import static com.lg5.spring.testcontainer.util.Constant.APP_PORT_DEFAULT;
+ import java.util.function.Consumer;
@Import({
PostgresContainerCustomConfig.class,
KafkaContainerCustomConfig.class,
WiremockContainerCustomConfig.class,
- WireMockGuiContainerCustomConfig.class
+ AppContainerCustomConfig.class
})
- public class TestContainersLoader {
+ public final class TestContainersLoader {
+
+ private final KafkaConfigData kafkaConfigData;
+
+ private final List containerConfigs;
+
+ public TestContainersLoader(KafkaConfigData kafkaConfigData, List containerConfigs) {
+ this.kafkaConfigData = kafkaConfigData;
+ this.containerConfigs = containerConfigs;
+ }
@Bean
- public AppCustomContainer apiContainer(PostgreSQLContainer> postgresContainer,
+ public AppCustomContainer apiContainer(AppCustomContainer appCustomContainer,
+ PostgreSQLContainer> postgresContainer,
KafkaContainer kafkaContainer,
- WireMockContainer wireMockContainer) {
+ WireMockContainer wireMockContainer,
+ GenericContainer> schemaRegistryContainer) {
+
+ appWithEnvBuilder(appCustomContainer.getEnvMap(), postgresContainer, kafkaContainer,
+ wireMockContainer, schemaRegistryContainer);
- AppCustomContainer appCustomContainer = new AppCustomContainer("com.blanksystem/blank-service:1.0.0-alpha");
- appCustomContainer.withFileSystemBind("./target/logs", "/logs", BindMode.READ_WRITE);
- appCustomContainer.withAppEnvVars(appWithEnvBuilder(postgresContainer, kafkaContainer, wireMockContainer));
appCustomContainer.start();
appCustomContainer.initRequestSpecification();
+ updateKafkaConfigData(kafkaContainer);
+
return appCustomContainer;
}
- private Map appWithEnvBuilder(PostgreSQLContainer> postgreSQLContainer,
- KafkaContainer kafkaContainer,
- WireMockContainer wireMockContainer) {
+ private void updateKafkaConfigData(KafkaContainer kafkaContainer) {
+ kafkaConfigData.setBootstrapServers(kafkaContainer.getBootstrapServers());
+ }
+
+ private void appWithEnvBuilder(Map envMap, PostgreSQLContainer> postgreSQLContainer,
+ KafkaContainer kafkaContainer,
+ WireMockContainer wireMockContainer,
+ GenericContainer> schemaRegistryContainer) {
+
+ final Map, Consumer