diff --git a/infra-spring/sb-out/src/main/resources/db.changelog-master.sql b/infra-spring/sb-out/src/main/resources/db.changelog-master.sql index 11ec951..fb52781 100644 --- a/infra-spring/sb-out/src/main/resources/db.changelog-master.sql +++ b/infra-spring/sb-out/src/main/resources/db.changelog-master.sql @@ -12,16 +12,15 @@ CREATE TABLE IF NOT EXISTS PERSON ( PRIMARY KEY (id) ); - ---INSERT INTO PERSON (id, first_name, last_name, gender, birth_date, birth_place, nationality) ---VALUES ---('123e4567-e89b-12d3-a456-426614174000', 'Alice', 'Dupont', 'Female', '1990-05-15 10:30:00', 'Paris', 'French'), ---('223e4567-e89b-12d3-a456-426614174001', 'Bob', 'Martin', 'Male', '1985-11-20 14:45:00', 'Lyon', 'French'), ---('323e4567-e89b-12d3-a456-426614174002', 'Charlie', 'Durand', 'Male', '1992-03-12 09:15:00', 'Marseille', 'French'), ---('423e4567-e89b-12d3-a456-426614174003', 'Diane', 'Leroy', 'Female', '1988-07-25 18:00:00', 'Toulouse', 'French'), ---('523e4567-e89b-12d3-a456-426614174004', 'Eve', 'Moreau', 'Female', '1995-01-30 11:00:00', 'Nice', 'French'), ---('623e4567-e89b-12d3-a456-426614174005', 'Frank', 'Garnier', 'Male', '1991-04-17 07:50:00', 'Strasbourg', 'French'), ---('723e4567-e89b-12d3-a456-426614174006', 'Grace', 'Carre', 'Female', '1993-08-22 16:20:00', 'Bordeaux', 'French'), ---('823e4567-e89b-12d3-a456-426614174007', 'Hugo', 'Gauthier', 'Male', '1989-12-01 15:30:00', 'Nantes', 'French'), ---('923e4567-e89b-12d3-a456-426614174008', 'Isabelle', 'Simon', 'Female', '1994-09-10 13:05:00', 'Montpellier', 'French'), ---('a23e4567-e89b-12d3-a456-426614174009', 'Jean', 'Benoit', 'Male', '1987-06-14 12:00:00', 'Rennes', 'French'); +INSERT INTO PERSON (id, first_name, last_name, gender, birth_date, birth_place, nationality) +VALUES +('123e4567-e89b-12d3-a456-426614174000', 'Alice', 'Dupont', 'Female', '1990-05-15 10:30:00', 'Paris', 'French'), +('223e4567-e89b-12d3-a456-426614174001', 'Bob', 'Martin', 'Male', '1985-11-20 14:45:00', 'Lyon', 'French'), +('323e4567-e89b-12d3-a456-426614174002', 'Charlie', 'Durand', 'Male', '1992-03-12 09:15:00', 'Marseille', 'French'), +('423e4567-e89b-12d3-a456-426614174003', 'Diane', 'Leroy', 'Female', '1988-07-25 18:00:00', 'Toulouse', 'French'), +('523e4567-e89b-12d3-a456-426614174004', 'Eve', 'Moreau', 'Female', '1995-01-30 11:00:00', 'Nice', 'French'), +('623e4567-e89b-12d3-a456-426614174005', 'Frank', 'Garnier', 'Male', '1991-04-17 07:50:00', 'Strasbourg', 'French'), +('723e4567-e89b-12d3-a456-426614174006', 'Grace', 'Carre', 'Female', '1993-08-22 16:20:00', 'Bordeaux', 'French'), +('823e4567-e89b-12d3-a456-426614174007', 'Hugo', 'Gauthier', 'Male', '1989-12-01 15:30:00', 'Nantes', 'French'), +('923e4567-e89b-12d3-a456-426614174008', 'Isabelle', 'Simon', 'Female', '1994-09-10 13:05:00', 'Montpellier', 'French'), +('a23e4567-e89b-12d3-a456-426614174009', 'Jean', 'Benoit', 'Male', '1987-06-14 12:00:00', 'Rennes', 'French'); diff --git a/infra-spring/sb-out/src/test/java/com/mpumd/poc/person/sb/jpa/PersonJpaAdapterITest.java b/infra-spring/sb-out/src/test/java/com/mpumd/poc/person/sb/jpa/PersonJpaAdapterITest.java index 21c994a..2a3729a 100644 --- a/infra-spring/sb-out/src/test/java/com/mpumd/poc/person/sb/jpa/PersonJpaAdapterITest.java +++ b/infra-spring/sb-out/src/test/java/com/mpumd/poc/person/sb/jpa/PersonJpaAdapterITest.java @@ -6,6 +6,7 @@ import com.mpumd.poc.person.sb.jpa.mapper.DomainJPAMapper; import lombok.SneakyThrows; import org.jeasy.random.EasyRandom; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; @@ -40,7 +41,7 @@ class PersonJpaAdapterITest { // TODO extract the postgres image name outside of here, anywhere who is possible de change easier it @Container @ServiceConnection - static final PostgreSQLContainer postgre = new PostgreSQLContainer("postgres:17-alpine"); + static final PostgreSQLContainer postgresContainer = new PostgreSQLContainer("postgres:17-alpine"); @Autowired PersonJpaAdapter adapter; @@ -49,6 +50,12 @@ class PersonJpaAdapterITest { EasyRandom easyRandom = new EasyRandom(); + @AfterAll + static void afterAll() { + // default destroy container after IT, avoid the conflict with a local run + postgresContainer.close(); + } + @Test void pushInDBWithoutError() { Person aggregatRoot = easyRandom.nextObject(Person.class);