From b9d59cbeed30ed91e2885275019ba328b4168507 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Fri, 21 Feb 2025 15:41:00 +0100 Subject: [PATCH 01/14] Parallelisation des tests en plusieurs jobs --- .gitlab-ci.yml | 14 +- .gitlab_test_mvn.yml | 215 ++++++++++++------ src/test/java/TestConfigurationSuite.java | 2 + .../java/fr/inra/oresing/ApplicationTest.java | 2 +- .../domain/LocalDateTimeRangeTest.java | 2 +- .../application/BrokenConfigurationTest.java | 3 +- .../domain/application/BuilderNodeTest.java | 2 +- .../configuration/ConfigurationTest.java | 2 +- .../application/configuration/LtreeTest.java | 2 +- .../configuration/SubmissionTest.java | 5 +- .../configuration/date/DatePatternTest.java | 2 +- .../checker/type/ReferenceTypeTest.java | 1 + .../data/read/DataHeaderReaderTest.java | 1 + .../domain/groovy/GroovyExpressionTest.java | 2 +- .../InternationalizationDisplayTest.java | 2 +- .../massimport/BuildFileHeaderTest.java | 2 + .../AuthenticationServiceTest.java | 3 +- .../data/read/bundle/FileContentTest.java | 2 + .../index/AuthorizationIndexTest.java | 1 + .../ApplicationConfigurationServiceTest.java | 1 + .../rest/AuthorizationResourcesTest.java | 2 + .../fr/inra/oresing/rest/MigrationTest.java | 4 +- .../fr/inra/oresing/rest/MultiYamlTest.java | 2 +- .../inra/oresing/rest/OreSiResourcesTest.java | 41 ++-- .../oresing/rest/TestReferencesErrors.java | 7 +- .../CreateAuthorizationRequestTest.java | 6 +- ...ownloadDatasetQueryAdvancedSearchTest.java | 2 +- .../model/data/DownloadDatasetQueryTest.java | 2 +- .../rest/services/RelationalServiceTest.java | 2 + 29 files changed, 210 insertions(+), 124 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 579dec6..b614a47 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -53,6 +53,8 @@ include: # - local: .gitlab_package.yml - local: .gitlab_build_doc.yml path: . + - local: .gitlab_test_mvn + path: . - local: .gitlab-ci_docker.yml path: . #- local: .gitlab-ci_sonar.yml @@ -60,15 +62,3 @@ include: # - local: .gitlab_build_doc2.yml -maven_test_configuration_build: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: mvn --batch-mode clean test -Ptest_configuration_build - tags: - - docker - artifacts: - reports: - junit: - - target/surefire-reports/TEST-*.xml - rules: - - if: $CI_JOB_MANUAL!= "true" diff --git a/.gitlab_test_mvn.yml b/.gitlab_test_mvn.yml index bec71a4..8f19398 100644 --- a/.gitlab_test_mvn.yml +++ b/.gitlab_test_mvn.yml @@ -1,118 +1,191 @@ -maven_test_rest_1: +test_core_basic: image: maven:3.9.4-amazoncorretto-21 stage: test - script: mvn --batch-mode clean test -Ptest_rest_1 - tags: - - docker + script: + - mvn test -Djunit.jupiter.tags=core.basic + artifacts: + when: always + reports: + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ + +test_core_config: + image: maven:3.9.4-amazoncorretto-21 + stage: test + script: + - mvn test -Djunit.jupiter.tags=core.config + artifacts: + when: always + reports: + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ + +test_core_auth: + image: maven:3.9.4-amazoncorretto-21 + stage: test + script: + - mvn test -Djunit.jupiter.tags=core.auth + artifacts: + when: always + reports: + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ + +test_domain_model: + image: maven:3.9.4-amazoncorretto-21 + stage: test + script: + - mvn test -Djunit.jupiter.tags=domain.model + artifacts: + when: always + reports: + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ + +test_domain_checker: + image: maven:3.9.4-amazoncorretto-21 + stage: test + script: + - mvn test -Djunit.jupiter.tags=domain.checker + artifacts: + when: always + reports: + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ + +test_domain_i18n: + image: maven:3.9.4-amazoncorretto-21 + stage: test + script: + - mvn test -Djunit.jupiter.tags=domain.i18n artifacts: + when: always reports: - junit: - - target/surefire-reports/TEST-*.xml - rules: - - if: $CI_JOB_MANUAL!= "true" + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ -maven_test_rest_1_ACBB: +test_integration_rest: image: maven:3.9.4-amazoncorretto-21 stage: test - script: mvn --batch-mode clean test -Ptest_rest_1_ACBB - tags: - - docker + script: + - mvn test -Djunit.jupiter.tags=integration.rest artifacts: + when: always reports: - junit: - - target/surefire-reports/TEST-*.xml - rules: - - if: $CI_JOB_MANUAL!= "true" + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ -maven_test_rest_1_Haute_Frequence: +test_integration_persistence: image: maven:3.9.4-amazoncorretto-21 stage: test - script: mvn --batch-mode clean test -Ptest_rest_1_Haute_Frequence - tags: - - docker + script: + - mvn test -Djunit.jupiter.tags=integration.persistence artifacts: + when: always reports: - junit: - - target/surefire-reports/TEST-*.xml - rules: - - if: $CI_JOB_MANUAL!= "true" + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ -maven_test_rest_2: +test_app_monsoere: image: maven:3.9.4-amazoncorretto-21 stage: test - script: mvn --batch-mode clean test -Ptest_rest_2 - tags: - - docker + script: + - mvn test -Djunit.jupiter.tags=app.monsoere artifacts: + when: always reports: - junit: - - target/surefire-reports/TEST-*.xml - rules: - - if: $CI_JOB_MANUAL!= "true" + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ -maven_test_rest_others: +test_app_haute_frequence: image: maven:3.9.4-amazoncorretto-21 stage: test - script: mvn --batch-mode clean test -Ptest_rest_others - tags: - - docker + script: + - mvn test -Djunit.jupiter.tags=app.haute_frequence artifacts: + when: always reports: - junit: - - target/surefire-reports/TEST-*.xml - rules: - - if: $CI_JOB_MANUAL!= "true" + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ -maven_test_checker: +test_app_acbb: image: maven:3.9.4-amazoncorretto-21 stage: test - script: mvn --batch-mode clean test -Ptest_checker - tags: - - docker + script: + - mvn test -Djunit.jupiter.tags=app.acbb artifacts: + when: always reports: - junit: - - target/surefire-reports/TEST-*.xml - rules: - - if: $CI_JOB_MANUAL!= "true" + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ -maven_test_model: +test_app_olac: image: maven:3.9.4-amazoncorretto-21 stage: test - script: mvn --batch-mode clean test -Ptest_model - tags: - - docker + script: + - mvn test -Djunit.jupiter.tags=app.olac artifacts: + when: always reports: - junit: - - target/surefire-reports/TEST-*.xml - rules: - - if: $CI_JOB_MANUAL!= "true" + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ -maven_test_persistence: +test_app_foret: image: maven:3.9.4-amazoncorretto-21 stage: test - script: mvn --batch-mode clean test -Ptest_persistence - tags: - - docker + script: + - mvn test -Djunit.jupiter.tags=app.foret artifacts: + when: always reports: - junit: - - target/surefire-reports/TEST-*.xml - rules: - - if: $CI_JOB_MANUAL!= "true" + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ +test_app_pattern: + image: maven:3.9.4-amazoncorretto-21 + stage: test + script: + - mvn test -Djunit.jupiter.tags=app.pattern + artifacts: + when: always + reports: + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ +test_app_recursivity: + image: maven:3.9.4-amazoncorretto-21 + stage: test + script: + - mvn test -Djunit.jupiter.tags=app.recursivity + artifacts: + when: always + reports: + junit: target/surefire-reports/*.xml + paths: + - target/surefire-reports/ -maven_swagger_build: +test_app_teledetection: image: maven:3.9.4-amazoncorretto-21 stage: test script: - - mvn --batch-mode clean test -Pswagger_build - tags: - - docker + - mvn test -Djunit.jupiter.tags=app.teledetection artifacts: + when: always + reports: + junit: target/surefire-reports/*.xml paths: - - documentations/ - rules: - - if: $CI_JOB_MANUAL!= "true" + - target/surefire-reports/ diff --git a/src/test/java/TestConfigurationSuite.java b/src/test/java/TestConfigurationSuite.java index 43754ee..509e69d 100644 --- a/src/test/java/TestConfigurationSuite.java +++ b/src/test/java/TestConfigurationSuite.java @@ -1,7 +1,9 @@ +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.platform.suite.api.*; @Suite +@Disabled @SelectPackages("fr.inra.oresing") @SuiteDisplayName("Tests for BrokenAdom") @Tag("MODEL_REQUEST_TEST") diff --git a/src/test/java/fr/inra/oresing/ApplicationTest.java b/src/test/java/fr/inra/oresing/ApplicationTest.java index f5f2ec4..c7398cf 100644 --- a/src/test/java/fr/inra/oresing/ApplicationTest.java +++ b/src/test/java/fr/inra/oresing/ApplicationTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test; import java.util.UUID; -@org.junit.jupiter.api.Tag("SUITE") +@org.junit.jupiter.api.Tag("core.basic") public class ApplicationTest { @Test public void test() { diff --git a/src/test/java/fr/inra/oresing/domain/LocalDateTimeRangeTest.java b/src/test/java/fr/inra/oresing/domain/LocalDateTimeRangeTest.java index d649aff..964b7a6 100644 --- a/src/test/java/fr/inra/oresing/domain/LocalDateTimeRangeTest.java +++ b/src/test/java/fr/inra/oresing/domain/LocalDateTimeRangeTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAccessor; -@org.junit.jupiter.api.Tag("SUITE") +@org.junit.jupiter.api.Tag("domain.model") public class LocalDateTimeRangeTest { /*@Test diff --git a/src/test/java/fr/inra/oresing/domain/application/BrokenConfigurationTest.java b/src/test/java/fr/inra/oresing/domain/application/BrokenConfigurationTest.java index de3f493..a277570 100644 --- a/src/test/java/fr/inra/oresing/domain/application/BrokenConfigurationTest.java +++ b/src/test/java/fr/inra/oresing/domain/application/BrokenConfigurationTest.java @@ -8,7 +8,8 @@ import java.util.List; import java.util.Optional; import static org.junit.jupiter.api.Assertions.*; -@org.junit.jupiter.api.Tag("SUITE") + +@org.junit.jupiter.api.Tag("core.config") class ConfigurationTest { diff --git a/src/test/java/fr/inra/oresing/domain/application/BuilderNodeTest.java b/src/test/java/fr/inra/oresing/domain/application/BuilderNodeTest.java index d500f50..93d49a6 100644 --- a/src/test/java/fr/inra/oresing/domain/application/BuilderNodeTest.java +++ b/src/test/java/fr/inra/oresing/domain/application/BuilderNodeTest.java @@ -12,7 +12,7 @@ import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; -@org.junit.jupiter.api.Tag("SUITE") +@org.junit.jupiter.api.Tag("core.config") class BuilderNodeTest { final Map<String, BuilderNode> builderNodes = Arrays.stream(new JsonRowMapper<BuilderNode>().readValue(""" [ diff --git a/src/test/java/fr/inra/oresing/domain/application/configuration/ConfigurationTest.java b/src/test/java/fr/inra/oresing/domain/application/configuration/ConfigurationTest.java index 6ba94dc..82fb90c 100644 --- a/src/test/java/fr/inra/oresing/domain/application/configuration/ConfigurationTest.java +++ b/src/test/java/fr/inra/oresing/domain/application/configuration/ConfigurationTest.java @@ -12,7 +12,7 @@ import org.mockito.Mockito; import java.util.*; -@org.junit.jupiter.api.Tag("SUITE") +@org.junit.jupiter.api.Tag("core.config") class ConfigurationTest { public static final JsonRowMapper MAPPER = new JsonRowMapper<ComponentDescription>(); diff --git a/src/test/java/fr/inra/oresing/domain/application/configuration/LtreeTest.java b/src/test/java/fr/inra/oresing/domain/application/configuration/LtreeTest.java index 80e5897..1de2049 100644 --- a/src/test/java/fr/inra/oresing/domain/application/configuration/LtreeTest.java +++ b/src/test/java/fr/inra/oresing/domain/application/configuration/LtreeTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.params.provider.ValueSource; import static org.junit.jupiter.api.Assertions.*; -@Tag("SUITE") +@Tag("core.config") class LtreeTest { @Test void assertThatAStringWithInvalidCharactersCanBeEncodedTwice(){ diff --git a/src/test/java/fr/inra/oresing/domain/application/configuration/SubmissionTest.java b/src/test/java/fr/inra/oresing/domain/application/configuration/SubmissionTest.java index 5955b26..b171d49 100644 --- a/src/test/java/fr/inra/oresing/domain/application/configuration/SubmissionTest.java +++ b/src/test/java/fr/inra/oresing/domain/application/configuration/SubmissionTest.java @@ -3,9 +3,7 @@ package fr.inra.oresing.domain.application.configuration; import fr.inra.oresing.domain.BinaryFileDataset; import fr.inra.oresing.domain.exceptions.authorization.AuthorizationRequestException; import fr.inra.oresing.domain.exceptions.authorization.SiOreAuthorizationRequestException; -import groovy.lang.Tuple; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import java.util.LinkedList; @@ -13,6 +11,7 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.*; +@Tag("domain.model") class SubmissionTest { final Submission submission = new Submission( SubmissionType.OA_VERSIONING, diff --git a/src/test/java/fr/inra/oresing/domain/application/configuration/date/DatePatternTest.java b/src/test/java/fr/inra/oresing/domain/application/configuration/date/DatePatternTest.java index 10962c5..dd5c0b3 100644 --- a/src/test/java/fr/inra/oresing/domain/application/configuration/date/DatePatternTest.java +++ b/src/test/java/fr/inra/oresing/domain/application/configuration/date/DatePatternTest.java @@ -10,7 +10,7 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.util.Objects; -@org.junit.jupiter.api.Tag("SUITE") +@org.junit.jupiter.api.Tag("domain.model") class DatePatternTest { public static final String DATE = "12/01/1925"; public static final String TIME = "12:23:56"; diff --git a/src/test/java/fr/inra/oresing/domain/checker/type/ReferenceTypeTest.java b/src/test/java/fr/inra/oresing/domain/checker/type/ReferenceTypeTest.java index d9a27bb..80dc060 100644 --- a/src/test/java/fr/inra/oresing/domain/checker/type/ReferenceTypeTest.java +++ b/src/test/java/fr/inra/oresing/domain/checker/type/ReferenceTypeTest.java @@ -15,6 +15,7 @@ import org.mockito.Mockito; import java.util.UUID; +@Tag("domain.checker") class ReferenceTypeTest { LineChecker.Transformer transformer; ImmutableMap<DataValue.LineIdentityColumnName, ImmutableSet<UUID>> referenceValues; diff --git a/src/test/java/fr/inra/oresing/domain/data/read/DataHeaderReaderTest.java b/src/test/java/fr/inra/oresing/domain/data/read/DataHeaderReaderTest.java index 17efa81..b1867ba 100644 --- a/src/test/java/fr/inra/oresing/domain/data/read/DataHeaderReaderTest.java +++ b/src/test/java/fr/inra/oresing/domain/data/read/DataHeaderReaderTest.java @@ -32,6 +32,7 @@ import java.util.Map; import java.util.stream.Collectors; @Tag("SUITE") +@Tag("domain.model") class DataHeaderReaderTest { Iterator<CSVRecord> lineIterator; DataHeaderReader reader; diff --git a/src/test/java/fr/inra/oresing/domain/groovy/GroovyExpressionTest.java b/src/test/java/fr/inra/oresing/domain/groovy/GroovyExpressionTest.java index d5c2119..2d44f51 100644 --- a/src/test/java/fr/inra/oresing/domain/groovy/GroovyExpressionTest.java +++ b/src/test/java/fr/inra/oresing/domain/groovy/GroovyExpressionTest.java @@ -17,7 +17,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; -@Tag("SUITE") +@Tag("domain.model") class GroovyExpressionTest { private Map<String, Object> context; diff --git a/src/test/java/fr/inra/oresing/domain/internationalization/InternationalizationDisplayTest.java b/src/test/java/fr/inra/oresing/domain/internationalization/InternationalizationDisplayTest.java index f388752..1e2c26e 100644 --- a/src/test/java/fr/inra/oresing/domain/internationalization/InternationalizationDisplayTest.java +++ b/src/test/java/fr/inra/oresing/domain/internationalization/InternationalizationDisplayTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; import java.util.List; -@org.junit.jupiter.api.Tag("SUITE") +@org.junit.jupiter.api.Tag("domain.i18n") public class InternationalizationDisplayTest { final String pattern = "column 1 {column1} column 2 {column2} column 3 {column3} end"; diff --git a/src/test/java/fr/inra/oresing/domain/massimport/BuildFileHeaderTest.java b/src/test/java/fr/inra/oresing/domain/massimport/BuildFileHeaderTest.java index 32a14e1..7b967bf 100644 --- a/src/test/java/fr/inra/oresing/domain/massimport/BuildFileHeaderTest.java +++ b/src/test/java/fr/inra/oresing/domain/massimport/BuildFileHeaderTest.java @@ -5,6 +5,7 @@ import fr.inra.oresing.domain.ConfigurationBuiderTestBuilder; import fr.inra.oresing.domain.application.configuration.*; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.slf4j.Logger; @@ -15,6 +16,7 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.function.Function; +@Tag("domain.model") public class BuildFileHeaderTest { private static final Logger log = LoggerFactory.getLogger(BuildFileHeaderTest.class); static final String RESOURCE_PATH = "fr/inra/oresing/domain/massimport/massimport.yaml"; diff --git a/src/test/java/fr/inra/oresing/persistence/AuthenticationServiceTest.java b/src/test/java/fr/inra/oresing/persistence/AuthenticationServiceTest.java index 8c129eb..5778b07 100644 --- a/src/test/java/fr/inra/oresing/persistence/AuthenticationServiceTest.java +++ b/src/test/java/fr/inra/oresing/persistence/AuthenticationServiceTest.java @@ -45,13 +45,14 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; @ActiveProfiles("testmail") -@SpringBootTest(classes = {OreSiNg.class, OreSiNg.MailSenderForTest.class, TestDatabaseConfig.class}) +@SpringBootTest(classes = {OreSiNg.class, OreSiNg.MailSenderForTest.class, TestDatabaseConfig.class, OreSiNg.class, TestDatabaseConfig.class}) @TestPropertySource(locations = "classpath:/application-tests.properties") @AutoConfigureWebMvc @AutoConfigureMockMvc(print = MockMvcPrint.NONE) @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) @Tag("SUITE") +@Tag("core.auth") public class AuthenticationServiceTest { @Value("${spring.mail.from}") String mailFrom; diff --git a/src/test/java/fr/inra/oresing/persistence/data/read/bundle/FileContentTest.java b/src/test/java/fr/inra/oresing/persistence/data/read/bundle/FileContentTest.java index d0dd693..2ae6fd8 100644 --- a/src/test/java/fr/inra/oresing/persistence/data/read/bundle/FileContentTest.java +++ b/src/test/java/fr/inra/oresing/persistence/data/read/bundle/FileContentTest.java @@ -5,6 +5,7 @@ import fr.inra.oresing.domain.application.configuration.Submission; import fr.inra.oresing.domain.application.configuration.SubmissionType; import org.assertj.core.api.AssertJProxySetup; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -14,6 +15,7 @@ import java.util.Optional; import static org.junit.jupiter.api.Assertions.*; +@Tag("domain.model") class FileContentTest { final Submission submission = new Submission( SubmissionType.OA_VERSIONING, diff --git a/src/test/java/fr/inra/oresing/persistence/index/AuthorizationIndexTest.java b/src/test/java/fr/inra/oresing/persistence/index/AuthorizationIndexTest.java index df59246..9861401 100644 --- a/src/test/java/fr/inra/oresing/persistence/index/AuthorizationIndexTest.java +++ b/src/test/java/fr/inra/oresing/persistence/index/AuthorizationIndexTest.java @@ -18,6 +18,7 @@ import java.util.*; import static org.junit.jupiter.api.Assertions.assertEquals; +@org.junit.jupiter.api.Tag("core.auth") class AuthorizationIndexTest { private AuthorizationIndex authorizationIndex; diff --git a/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java b/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java index 30b034e..1e7b513 100644 --- a/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java +++ b/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java @@ -47,6 +47,7 @@ import static org.junit.jupiter.api.Assertions.*; @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @Slf4j @org.junit.jupiter.api.Tag("SUITE") +@org.junit.jupiter.api.Tag("core.config") public class ApplicationConfigurationServiceTest { public static final Map<String, List<ReactiveResult>> errors = new HashMap<>(); diff --git a/src/test/java/fr/inra/oresing/rest/AuthorizationResourcesTest.java b/src/test/java/fr/inra/oresing/rest/AuthorizationResourcesTest.java index a51eee5..9c3923f 100644 --- a/src/test/java/fr/inra/oresing/rest/AuthorizationResourcesTest.java +++ b/src/test/java/fr/inra/oresing/rest/AuthorizationResourcesTest.java @@ -19,6 +19,7 @@ import org.hamcrest.core.IsEqual; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -53,6 +54,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @AutoConfigureMockMvc(print = MockMvcPrint.NONE) @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) @Slf4j +@Tag("core.auth") public class AuthorizationResourcesTest { @Autowired diff --git a/src/test/java/fr/inra/oresing/rest/MigrationTest.java b/src/test/java/fr/inra/oresing/rest/MigrationTest.java index 6612694..58d3b68 100644 --- a/src/test/java/fr/inra/oresing/rest/MigrationTest.java +++ b/src/test/java/fr/inra/oresing/rest/MigrationTest.java @@ -5,6 +5,7 @@ import fr.inra.oresing.TestDatabaseConfig; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -25,12 +26,13 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @ActiveProfiles("testmail") +@Tag("integration.persistence") @SpringBootTest(classes = {OreSiNg.class, TestDatabaseConfig.class}) @TestPropertySource(locations = "classpath:/application-tests.properties") @AutoConfigureWebMvc @AutoConfigureMockMvc(print = MockMvcPrint.NONE) -@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) @Slf4j public class MigrationTest { diff --git a/src/test/java/fr/inra/oresing/rest/MultiYamlTest.java b/src/test/java/fr/inra/oresing/rest/MultiYamlTest.java index 662994b..c0e6d38 100644 --- a/src/test/java/fr/inra/oresing/rest/MultiYamlTest.java +++ b/src/test/java/fr/inra/oresing/rest/MultiYamlTest.java @@ -12,7 +12,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.Map; -@org.junit.jupiter.api.Tag("SUITE") +@org.junit.jupiter.api.Tag("core.basic") public class MultiYamlTest { @Test public void testYaml() throws IOException { diff --git a/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java b/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java index 98a25f9..e00c830 100644 --- a/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java +++ b/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java @@ -90,6 +90,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @AutoConfigureWebMvc @AutoConfigureMockMvc(print = MockMvcPrint.NONE) @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) +@Tag("integration.rest") @Slf4j public class OreSiResourcesTest { @@ -168,7 +169,7 @@ public class OreSiResourcesTest { } @Test - @Tag("SUITE") + @Tag("core.basic") public void testDatabaseUser() throws SQLException { String currentUser = getCurrentDatabaseUser(); Assertions.assertEquals("openAdomTechUser", currentUser, "Le test devrait être exécuté en tant qu'openadomTechUser"); @@ -187,7 +188,7 @@ public class OreSiResourcesTest { @Test @Tag("SWAGGER_BUILD") - @Tag("SUITE") + @Tag("integration.rest") public void services_model() throws Exception { final String services_model = mockMvc.perform(get("/api-docs") .accept(MediaType.APPLICATION_JSON_VALUE) @@ -248,7 +249,7 @@ public class OreSiResourcesTest { @Test @Tag("OTHERS_TEST") - @Tag("SUITE") + @Tag("app.monsoere") @Tag("MONSOERE") public void addApplicationMonsore() throws Exception { final String appId; @@ -808,14 +809,14 @@ public class OreSiResourcesTest { @Test @Tag("OTHERS_TEST") - @Tag("SUITE") + @Tag("integration.rest") public void buildSwaggerApi() throws Exception { mockMvc.perform(get("/v2/api-docs")); } @Test @Tag("OTHERS_TEST") - @Tag("SUITE") + @Tag("domain.model") public void testMultiplicityMany() throws Exception { final URL resource = getClass().getResource(Fixtures.getMultiplicityMany()); try (final InputStream in = Objects.requireNonNull(resource).openStream()) { @@ -887,7 +888,7 @@ public class OreSiResourcesTest { } @Test - @Tag("OTHERS_TEST") + @Tag("core.config") @Disabled public void addApplicationWithComputedComponentsWithReferences() throws Exception { final URL resource = getClass().getResource(Fixtures.getApplicationWithComputedComponentsWithReferences()); @@ -950,7 +951,7 @@ public class OreSiResourcesTest { @Test @Tag("OTHERS_TEST") - @Tag("SUITE") + @Tag("app.monsoere") @Tag("MONSOERE") public void addApplicationMonsoreWithRepository() throws Exception { URL resource = getClass().getResource(Fixtures.getMonsoreApplicationConfigurationWithRepositoryResourceName()); @@ -1733,6 +1734,7 @@ public class OreSiResourcesTest { } @Test + @Tag("app.teledetection") @Disabled public void addApplicationTeledetection() throws Exception { final URL resource = getClass().getResource(Fixtures.getTeledetectionConfigurationResourceName()); @@ -1993,6 +1995,7 @@ public class OreSiResourcesTest { * The only authorizations that can be put on are on none or all values. */ @Test + @Tag("core.config") @Disabled public void testProgressiveYamlWithoutAuthorization() throws Exception { final String authorizationId; @@ -2099,6 +2102,7 @@ public class OreSiResourcesTest { @Test @Disabled + @Tag("core.config") public void testProgressiveYamlWithEmptyDatagroup() throws Exception { final URL resource = getClass().getResource(Fixtures.getProgressiveYaml().get("yamlWithEmptyDatagroup")); @@ -2121,6 +2125,7 @@ public class OreSiResourcesTest { */ @Test @Disabled + @Tag("core.config") public void testProgressiveYamlWithNoReference() throws Exception { final URL resource = getClass().getResource(Fixtures.getProgressiveYaml().get("testAuthorizationScopeWithoutReference")); @@ -2146,6 +2151,7 @@ public class OreSiResourcesTest { @Test @Disabled + @Tag("core.config") public void testProgressiveYamlWithoutAuthorizationScope() { final URL resource = getClass().getResource(Fixtures.getProgressiveYaml().get("testProgressiveYamlWithoutAuthorizationScope")); @@ -2165,6 +2171,7 @@ public class OreSiResourcesTest { @Test @Disabled + @Tag("core.config") public void testProgressiveYamlWithoutTimescopeScope() { final URL resource = getClass().getResource(Fixtures.getProgressiveYaml().get("testProgressiveYamlWithoutTimescopeScope")); @@ -2188,6 +2195,7 @@ public class OreSiResourcesTest { */ @Test @Disabled + @Tag("core.config") public void testProgressiveWithReferenceAndNoHierarchicalReferenceYaml() throws Exception { final URL resource = getClass().getResource(Fixtures.getProgressiveYaml().get("testAuthorizationScopeWithReferenceAndNoHierarchicalReference")); @@ -2242,8 +2250,7 @@ public class OreSiResourcesTest { @Test @Tag("SUITE") - - + @Tag("app.recursivity") public void testRecursivity() throws Exception { final URL resource = getClass().getResource(Fixtures.getRecursivityApplicationConfigurationResourceName()); @@ -2329,6 +2336,7 @@ public class OreSiResourcesTest { @Test @Tag("SUITE") + @Tag("app.pattern") public void testPattern() throws Exception { final URL resource = getClass().getResource(Fixtures.getPatternApplicationConfigurationResourceName()); @@ -2443,6 +2451,7 @@ public class OreSiResourcesTest { @Test @Tag("SUITE") + @Tag("core.config") public void testComputedWithNaturalKeyColumns() throws Exception { final URL resource = getClass().getResource(Fixtures.getComputedWithNaturalKeyColumns()); @@ -2539,7 +2548,7 @@ public class OreSiResourcesTest { } @Test - @Tag("ACBB_TEST") + @Tag("app.acbb") public void addApplicationAcbb() throws Exception { addUserRightCreateApplication(authUserId, "acbb"); final URL resource = getClass().getResource(Fixtures.getAcbbApplicationConfigurationResourceName()); @@ -2772,7 +2781,7 @@ public class OreSiResourcesTest { } @Test - @Tag("HAUTE_FREQUENCE_TEST") + @Tag("app.haute_frequence") @Disabled public void addApplicationHauteFrequence() throws Throwable { addUserRightCreateApplication(authUserId, "hautefrequence"); @@ -2803,7 +2812,7 @@ public class OreSiResourcesTest { } @Test - @Tag("OTHERS_TEST") + @Tag("domain.model") @Disabled public void addDuplicatedTest() throws Throwable { addUserRightCreateApplication(authUserId, "duplicated"); @@ -3056,7 +3065,7 @@ on test le dépôt d'un fichier récursif } @Test - @Tag("OTHERS_TEST") + @Tag("app.olac") @Disabled public void addApplicationOLAC() throws Exception { addUserRightCreateApplication(authUserId, "olac"); @@ -3151,7 +3160,7 @@ on test le dépôt d'un fichier récursif } @Test - @Tag("OTHERS_TEST") + @Tag("app.foret") @Disabled public void addApplicationFORET_essai() throws Exception { addUserRightCreateApplication(authUserId, "foret"); @@ -3201,7 +3210,7 @@ on test le dépôt d'un fichier récursif } @Test - @Tag("OTHERS_TEST") + @Tag("app.foret") @Disabled public void addApplicationFORET() throws Exception { addUserRightCreateApplication(authUserId, "foret"); @@ -3236,6 +3245,7 @@ on test le dépôt d'un fichier récursif @Test @Disabled("utile comme benchmark, ne vérifie rien") + @Tag("integration.persistence") public void benchmarkImportData() throws Exception { addApplicationAcbb(); try (final InputStream in = fixtures.openSwcDataResourceName(false)) { @@ -3252,6 +3262,7 @@ on test le dépôt d'un fichier récursif @Test @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @Disabled + @Tag("integration.rest") public void testGetUploadBundle() throws Exception { URL resource = getClass().getResource(Fixtures.getMonsoreApplicationConfigurationWithRepositoryResourceName()); try (final InputStream in = Objects.requireNonNull(resource).openStream()) { diff --git a/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java b/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java index 31cb2f2..56a2cdd 100644 --- a/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java +++ b/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java @@ -13,10 +13,7 @@ import org.hamcrest.core.IsNull; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.*; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; import org.springframework.beans.factory.annotation.Autowired; @@ -30,7 +27,6 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.transaction.annotation.Transactional; @@ -57,6 +53,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @AutoConfigureMockMvc(print = MockMvcPrint.NONE) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @Slf4j +@Tag("domain.model") public class TestReferencesErrors { public static final Map<String, String> responses = new HashMap<>(); diff --git a/src/test/java/fr/inra/oresing/rest/model/authorization/CreateAuthorizationRequestTest.java b/src/test/java/fr/inra/oresing/rest/model/authorization/CreateAuthorizationRequestTest.java index 6be15e1..18ae26b 100644 --- a/src/test/java/fr/inra/oresing/rest/model/authorization/CreateAuthorizationRequestTest.java +++ b/src/test/java/fr/inra/oresing/rest/model/authorization/CreateAuthorizationRequestTest.java @@ -15,8 +15,7 @@ import fr.inra.oresing.domain.repository.authorization.OperationType; import fr.inra.oresing.persistence.JsonRowMapper; import fr.inra.oresing.persistence.data.read.DataRepositoryWithBuffer; import fr.inra.oresing.rest.model.authorization.exception.AuthorizationRequestError; -import fr.inra.oresing.rest.model.authorization.request.AuthorizationRequestBuilder; -import lombok.SneakyThrows; +import fr.inra.oresing.rest.model.authorization.request.AuthorizationRequestBuilder;= import org.json.JSONException; import org.junit.jupiter.api.*; import org.mockito.Mockito; @@ -29,7 +28,6 @@ import java.nio.charset.StandardCharsets; import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; -import java.util.stream.Stream; class CreateAuthorizationRequestTest { static String createAuthorization; @@ -41,7 +39,7 @@ class CreateAuthorizationRequestTest { } @Test - @Tag("SUITE") + @Tag("core.auth") void toAuthorizationRequest() throws IOException { CreateAuthorizationRequest createAuthorizationRequest1 = new CreateAuthorizationRequest( UUID.fromString("e7570009-35fb-489d-ad3b-5bb335e7c5d5"), diff --git a/src/test/java/fr/inra/oresing/rest/model/data/DownloadDatasetQueryAdvancedSearchTest.java b/src/test/java/fr/inra/oresing/rest/model/data/DownloadDatasetQueryAdvancedSearchTest.java index 85b4ec4..64f74c4 100644 --- a/src/test/java/fr/inra/oresing/rest/model/data/DownloadDatasetQueryAdvancedSearchTest.java +++ b/src/test/java/fr/inra/oresing/rest/model/data/DownloadDatasetQueryAdvancedSearchTest.java @@ -16,7 +16,7 @@ import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.*; -@Tag("MODEL_REQUEST_TEST") +@Tag("integration.persistence\n") class DownloadDatasetQueryAdvancedSearchTest { public static JsonRowMapper mapper; public static final Set<String> rowIds = Set.of("addf3698-88f2-43f9-8926-0b64a86f3678", "0aef7ed1-1df9-4fbf-a676-1932e87ced9d", "2c527cbe-3ed7-4883-b7d1-8f29eff99eb1"); diff --git a/src/test/java/fr/inra/oresing/rest/model/data/DownloadDatasetQueryTest.java b/src/test/java/fr/inra/oresing/rest/model/data/DownloadDatasetQueryTest.java index 883e74b..a2356a2 100644 --- a/src/test/java/fr/inra/oresing/rest/model/data/DownloadDatasetQueryTest.java +++ b/src/test/java/fr/inra/oresing/rest/model/data/DownloadDatasetQueryTest.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; -@Tag("MODEL_REQUEST_TEST") +@Tag("integration.persistence\n") @Disabled class DownloadDatasetQueryTest { final String simpleSearchJson = """ diff --git a/src/test/java/fr/inra/oresing/rest/services/RelationalServiceTest.java b/src/test/java/fr/inra/oresing/rest/services/RelationalServiceTest.java index a7dfa5b..77d9c78 100644 --- a/src/test/java/fr/inra/oresing/rest/services/RelationalServiceTest.java +++ b/src/test/java/fr/inra/oresing/rest/services/RelationalServiceTest.java @@ -8,6 +8,7 @@ import fr.inra.oresing.rest.OreSiResourcesTest; import fr.inra.oresing.rest.ViewStrategy; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -66,6 +67,7 @@ public class RelationalServiceTest { @Test @Disabled + @Tag("integration.persistence\n") public void testCreateViews() { // request.setRequestClient(applicationCreatorRequestClient); final ImmutableSet<Fixtures.Application> applications = ImmutableSet -- GitLab From c100a46d55f18b180fe53c03153e1a8587f31a32 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Fri, 21 Feb 2025 15:48:44 +0100 Subject: [PATCH 02/14] Correction ci --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b614a47..f66ccb1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -53,7 +53,7 @@ include: # - local: .gitlab_package.yml - local: .gitlab_build_doc.yml path: . - - local: .gitlab_test_mvn + - local: .gitlab_test.yml path: . - local: .gitlab-ci_docker.yml path: . -- GitLab From 59dfa246254deaaa9653a2fc97a3ef7eb4c08a77 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Fri, 21 Feb 2025 15:49:52 +0100 Subject: [PATCH 03/14] Correction ci --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f66ccb1..c91d0ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -53,7 +53,7 @@ include: # - local: .gitlab_package.yml - local: .gitlab_build_doc.yml path: . - - local: .gitlab_test.yml + - local: .gitlab_test_mvn.yml path: . - local: .gitlab-ci_docker.yml path: . -- GitLab From e81fe674fa03b2148e6ad53296c2e7686571e302 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Fri, 21 Feb 2025 15:54:52 +0100 Subject: [PATCH 04/14] Correction ci --- .../model/authorization/CreateAuthorizationRequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/fr/inra/oresing/rest/model/authorization/CreateAuthorizationRequestTest.java b/src/test/java/fr/inra/oresing/rest/model/authorization/CreateAuthorizationRequestTest.java index 18ae26b..e1d4cc4 100644 --- a/src/test/java/fr/inra/oresing/rest/model/authorization/CreateAuthorizationRequestTest.java +++ b/src/test/java/fr/inra/oresing/rest/model/authorization/CreateAuthorizationRequestTest.java @@ -15,7 +15,7 @@ import fr.inra.oresing.domain.repository.authorization.OperationType; import fr.inra.oresing.persistence.JsonRowMapper; import fr.inra.oresing.persistence.data.read.DataRepositoryWithBuffer; import fr.inra.oresing.rest.model.authorization.exception.AuthorizationRequestError; -import fr.inra.oresing.rest.model.authorization.request.AuthorizationRequestBuilder;= +import fr.inra.oresing.rest.model.authorization.request.AuthorizationRequestBuilder; import org.json.JSONException; import org.junit.jupiter.api.*; import org.mockito.Mockito; -- GitLab From 875fa9a54ba287ecff7bb359ef2f6c62ed3f1038 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Mon, 24 Feb 2025 16:23:17 +0100 Subject: [PATCH 05/14] =?UTF-8?q?Modification=20de=20la=20strat=C3=A9gie?= =?UTF-8?q?=20de=20tests=20-=20il=20emble=20que=20le=20lancement=20des=20t?= =?UTF-8?q?ests=20en=20passant=20directement=20un=20tag=20ne=20fonctionne?= =?UTF-8?q?=20pas=20-=20on=20met=20en=20place=20une=20strat=C3=A9gie=20par?= =?UTF-8?q?=20profile=20-=20on=20lance=20les=20tests=20par=20profile=20-?= =?UTF-8?q?=20un=20h=C3=A9ritage=20opermet=20de=20cr=C3=A9er=20des=20job?= =?UTF-8?q?=20en=20param=C3=A9trant=20le=20test=20sur=20le=20nom=20du=20jo?= =?UTF-8?q?b=20-=20un=20profil=20par=20d=C3=A9faut=20lance=20tous=20les=20?= =?UTF-8?q?tests=20-=20le=20job=20no-tag=20lance=20les=20tests=20non=20tag?= =?UTF-8?q?ues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab_test_mvn.yml | 186 +++++--------------------- pom.xml | 311 +++++++++++++++++++++++++++++++------------ 2 files changed, 258 insertions(+), 239 deletions(-) diff --git a/.gitlab_test_mvn.yml b/.gitlab_test_mvn.yml index 8f19398..fd40243 100644 --- a/.gitlab_test_mvn.yml +++ b/.gitlab_test_mvn.yml @@ -1,191 +1,71 @@ -test_core_basic: +.st_test_template: &test_template image: maven:3.9.4-amazoncorretto-21 stage: test - script: - - mvn test -Djunit.jupiter.tags=core.basic artifacts: when: always reports: junit: target/surefire-reports/*.xml paths: - target/surefire-reports/ + script: + - | + # Par défaut, si le job est nommé "test_all" on ne filtre pas (profil all-tests) + # Sinon, on retire le préfixe "test_" et on remplace le premier underscore par un point. + if [[ "$CI_JOB_NAME" == "test_all" ]]; then + export MAVEN_PROFILE=all-tests + else + export MAVEN_PROFILE=$(echo "$CI_JOB_NAME" | sed -e 's/^test_//' -e 's/_/./') + fi + echo "Utilisation du profil Maven: $MAVEN_PROFILE" + - mvn test -P$MAVEN_PROFILE + +test_core_basic: + <<: *test_template test_core_config: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=core.config - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_core_auth: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=core.auth - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_domain_model: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=domain.model - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_domain_checker: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=domain.checker - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_domain_i18n: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=domain.i18n - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_integration_rest: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=integration.rest - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_integration_persistence: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=integration.persistence - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_app_monsoere: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=app.monsoere - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_app_haute_frequence: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=app.haute_frequence - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_app_acbb: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=app.acbb - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_app_olac: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=app.olac - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_app_foret: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=app.foret - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_app_pattern: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=app.pattern - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_app_recursivity: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=app.recursivity - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template test_app_teledetection: - image: maven:3.9.4-amazoncorretto-21 - stage: test - script: - - mvn test -Djunit.jupiter.tags=app.teledetection - artifacts: - when: always - reports: - junit: target/surefire-reports/*.xml - paths: - - target/surefire-reports/ + <<: *test_template + +test_no-tags: + <<: *test_template diff --git a/pom.xml b/pom.xml index e618948..dd6c384 100644 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,8 @@ <!--sonar--> <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> - <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco.exec</sonar.coverage.jacoco.xmlReportPaths> + <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco.exec + </sonar.coverage.jacoco.xmlReportPaths> <sonar.language>java</sonar.language> <sonar.projectKey>anaee-dev_openadom_backend_caf3d282-990e-4907-8f15-44424cf3c8b0</sonar.projectKey> <sonar.projectName>openADOM-backend</sonar.projectName> @@ -400,6 +401,12 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <!-- Utilisez une version récente pour être certain du support adéquat de JUnit 5 --> + <version>3.0.0-M5</version> + </plugin> </plugins> </build> <profiles> @@ -442,224 +449,356 @@ </plugins> </build> </profile> + <profile> + <id>core.basic</id> + <properties> + <junit.jupiter.tags>core.basic</junit.jupiter.tags> + </properties> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> + <configuration> + <includeTags>${junit.jupiter.tags}</includeTags> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <!-- Profil pour les tests tagués "core.config" --> <profile> - <id>test_checker</id> + <id>core.config</id> + <properties> + <junit.jupiter.tags>core.config</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <forkCount>4</forkCount> - <parallel>classesAndMethods</parallel> - <threadCount>4</threadCount> - <perCoreThreadCount>true</perCoreThreadCount> - <parallelTestsTimeoutInSeconds>300</parallelTestsTimeoutInSeconds> - <parallelTestsTimeoutForcedInSeconds>600</parallelTestsTimeoutForcedInSeconds> - <parallelOptimized>true</parallelOptimized> - - <reuseForks>false</reuseForks> - <testSourceDirectory>src/test</testSourceDirectory> - <testFailureIgnore>false</testFailureIgnore> - <includes> - <include>fr/inra/oresing/checker/**.java</include> - </includes> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + + <!-- Profil pour les tests tagués "core.auth" --> <profile> - <id>test_model</id> + <id>core.auth</id> + <properties> + <junit.jupiter.tags>core.auth</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <forkCount>4</forkCount> - <reuseForks>false</reuseForks> - <testSourceDirectory>src/test</testSourceDirectory> - <testFailureIgnore>false</testFailureIgnore> - <includes> - <include>fr/inra/oresing/model/**Test.java</include> - <include>fr/inra/oresing/model/**/**Test.java</include> - </includes> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + + <!-- Profil pour les tests tagués "domain.model" --> <profile> - <id>test_persistence</id> + <id>domain.model</id> + <properties> + <junit.jupiter.tags>domain.model</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <forkCount>4</forkCount> - <reuseForks>false</reuseForks> - <testSourceDirectory>src/test</testSourceDirectory> - <testFailureIgnore>false</testFailureIgnore> - <includes> - <include>fr/inra/oresing/persistence/**Test.java</include> - </includes> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + + <!-- Profil pour les tests tagués "domain.checker" --> <profile> - <id>test_rest_1</id> + <id>domain.checker</id> + <properties> + <junit.jupiter.tags>domain.checker</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <forkCount>4</forkCount> - <reuseForks>false</reuseForks> - <testSourceDirectory>src/test</testSourceDirectory> - <testFailureIgnore>false</testFailureIgnore> - <includes> - <include>fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java</include> - <include>fr/inra/oresing/rest/Migration.java</include> - <include>fr/inra/oresing/rest/MultiYaml.java</include> - <include>fr/inra/oresing/rest/RelationalService.java</include> - <include>fr/inra/oresing/rest/TestReferencesErrors.java</include> - </includes> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + + <!-- Profil pour les tests tagués "domain.i18n" --> <profile> - <id>test_rest_1_Haute_Frequence</id> + <id>domain.i18n</id> + <properties> + <junit.jupiter.tags>domain.i18n</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <forkCount>4</forkCount> - <reuseForks>false</reuseForks> - <testSourceDirectory>src/test</testSourceDirectory> - <testFailureIgnore>false</testFailureIgnore> - <groups>HAUTE_FREQUENCE_TEST</groups> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + + <!-- Profil pour les tests tagués "integration.rest" --> <profile> - <id>test_rest_1_ACBB</id> + <id>integration.rest</id> + <properties> + <junit.jupiter.tags>integration.rest</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <forkCount>4</forkCount> - <reuseForks>false</reuseForks> - <testSourceDirectory>src/test</testSourceDirectory> - <testFailureIgnore>false</testFailureIgnore> - <groups>ACBB_TEST</groups> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + + <!-- Profil pour les tests tagués "integration.persistence" --> <profile> - <id>test_rest_2</id> + <id>integration.persistence</id> + <properties> + <junit.jupiter.tags>integration.persistence</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <forkCount>4</forkCount> - <reuseForks>false</reuseForks> - <testSourceDirectory>src/test</testSourceDirectory> - <testFailureIgnore>false</testFailureIgnore> - <includes> - </includes> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + + <!-- Profils pour les tests applicatifs --> <profile> - <id>swagger_build</id> + <id>app.monsoere</id> + <properties> + <junit.jupiter.tags>app.monsoere</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <forkCount>4</forkCount> - <reuseForks>false</reuseForks> - <testSourceDirectory>src/test</testSourceDirectory> - <testFailureIgnore>false</testFailureIgnore> - <groups>SWAGGER_BUILD</groups> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + <profile> - <id>test_rest_others</id> + <id>app.haute_frequence</id> + <properties> + <junit.jupiter.tags>app.haute_frequence</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <forkCount>4</forkCount> - <reuseForks>false</reuseForks> - <testSourceDirectory>src/test</testSourceDirectory> - <testFailureIgnore>false</testFailureIgnore> - <groups>OTHERS_TEST</groups> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + <profile> - <id>test_rest_model_request_test</id> + <id>app.acbb</id> + <properties> + <junit.jupiter.tags>app.acbb</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <forkCount>4</forkCount> - <reuseForks>false</reuseForks> - <testSourceDirectory>src/test</testSourceDirectory> - <testFailureIgnore>false</testFailureIgnore> - <groups>MODEL_REQUEST_TEST</groups> + <includeTags>${junit.jupiter.tags}</includeTags> + </configuration> + </plugin> + </plugins> + </build> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> + <configuration> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + <profile> - <id>test_configuration_build</id> + <id>app.olac</id> + <properties> + <junit.jupiter.tags>app.olac</junit.jupiter.tags> + </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> <configuration> - <includes> - <include>TestConfigurationSuite</include> - </includes> + <includeTags>${junit.jupiter.tags}</includeTags> </configuration> </plugin> </plugins> </build> </profile> + + <profile> + <id>app.foret</id> + <properties> + <junit.jupiter.tags>app.foret</junit.jupiter.tags> + </properties> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> + <configuration> + <includeTags>${junit.jupiter.tags}</includeTags> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>app.pattern</id> + <properties> + <junit.jupiter.tags>app.pattern</junit.jupiter.tags> + </properties> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> + <configuration> + <includeTags>${junit.jupiter.tags}</includeTags> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>app.recursivity</id> + <properties> + <junit.jupiter.tags>app.recursivity</junit.jupiter.tags> + </properties> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> + <configuration> + <includeTags>${junit.jupiter.tags}</includeTags> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>app.teledetection</id> + <properties> + <junit.jupiter.tags>app.teledetection</junit.jupiter.tags> + </properties> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> + <configuration> + <includeTags>${junit.jupiter.tags}</includeTags> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>no-tags</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M5</version> + <configuration> + <excludeTags> + core.basic,core.config,core.auth, + domain.model,domain.checker,domain.i18n, + integration.rest,integration.persistence, + app.monsoere,app.haute_frequence,app.acbb, + app.olac,app.foret,app.pattern,app.recursivity,app.teledetection + </excludeTags> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>all-tests</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + </profile> </profiles> </project> \ No newline at end of file -- GitLab From 4a48821a76698da52c11c0f5c3b76679bdc5fc33 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Mon, 24 Feb 2025 17:10:30 +0100 Subject: [PATCH 06/14] correction pom --- pom.xml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pom.xml b/pom.xml index dd6c384..c8fd5b3 100644 --- a/pom.xml +++ b/pom.xml @@ -664,18 +664,6 @@ </plugin> </plugins> </build> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>3.0.0-M5</version> - <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> - </configuration> - </plugin> - </plugins> - </build> </profile> <profile> -- GitLab From 56617cf9e6f8a79d1e43ead30038c488aa9f010e Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Tue, 25 Feb 2025 10:02:41 +0100 Subject: [PATCH 07/14] modification de l'incusion des tags dans le profil --- pom.xml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index c8fd5b3..002f5c6 100644 --- a/pom.xml +++ b/pom.xml @@ -461,7 +461,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -481,7 +481,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -501,7 +501,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -521,7 +521,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -541,7 +541,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -561,7 +561,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -581,7 +581,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -601,7 +601,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -621,7 +621,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -640,7 +640,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -659,7 +659,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -678,7 +678,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -697,7 +697,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -716,7 +716,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -735,7 +735,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> @@ -754,7 +754,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <includeTags>${junit.jupiter.tags}</includeTags> + <groups>${junit.jupiter.tags}</groups> </configuration> </plugin> </plugins> -- GitLab From 3214c342c10f3b52d1a3e34459a7c9c1bbe8b2f6 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Tue, 25 Feb 2025 10:10:52 +0100 Subject: [PATCH 08/14] Suavegarde du .m2 dans le cache --- .gitlab-ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c91d0ba..3abae23 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,7 +41,15 @@ stages: maven_build: image: maven:3.9.4-amazoncorretto-21 stage: build - script: mvn --batch-mode clean compile + script: + - mvn --batch-mode clean dependency:go-offline test-compile -DskipTests + cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - .m2/repository/ + artifacts: + paths: + - target/ tags: - docker rules: -- GitLab From 417d2184b14cbfa1d5e582b9cd1dd1593620a8c7 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Tue, 25 Feb 2025 10:20:58 +0100 Subject: [PATCH 09/14] Re correction du pom --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3abae23..22e131b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,7 +42,7 @@ maven_build: image: maven:3.9.4-amazoncorretto-21 stage: build script: - - mvn --batch-mode clean dependency:go-offline test-compile -DskipTests + - mvn --batch-mode clean compile test-compile -DskipTests cache: key: ${CI_COMMIT_REF_SLUG} paths: -- GitLab From 9ba920a49b023bd22ea5fc7c13c085a14af5a0f2 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Tue, 25 Feb 2025 10:35:58 +0100 Subject: [PATCH 10/14] Suppression de la suite --- src/test/java/TestConfigurationSuite.java | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 src/test/java/TestConfigurationSuite.java diff --git a/src/test/java/TestConfigurationSuite.java b/src/test/java/TestConfigurationSuite.java deleted file mode 100644 index 509e69d..0000000 --- a/src/test/java/TestConfigurationSuite.java +++ /dev/null @@ -1,12 +0,0 @@ -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Tag; -import org.junit.platform.suite.api.*; - -@Suite -@Disabled -@SelectPackages("fr.inra.oresing") -@SuiteDisplayName("Tests for BrokenAdom") -@Tag("MODEL_REQUEST_TEST") -@IncludeTags({"UPLOAD_BUNDLE", "SUITE"}) -public class TestConfigurationSuite { -} -- GitLab From 234e4e892c1936eaeb31d97e3fbfd735d286a83e Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Tue, 25 Feb 2025 11:00:16 +0100 Subject: [PATCH 11/14] Modification des tests TestReferencesErrors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On ne relève pas l'erreur existing login --- .../java/fr/inra/oresing/rest/TestReferencesErrors.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java b/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java index 56a2cdd..5a6642e 100644 --- a/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java +++ b/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; import fr.inra.oresing.OreSiNg; import fr.inra.oresing.TestDatabaseConfig; +import fr.inra.oresing.persistence.AuthenticationFailure; import fr.inra.oresing.persistence.AuthenticationService; import fr.inra.oresing.persistence.JsonRowMapper; import lombok.extern.slf4j.Slf4j; @@ -86,7 +87,11 @@ public class TestReferencesErrors { CreateUserResult authUser = authenticationService.createUser("poussin", "xxxxxxxx", "poussin@inrae.fr"); final UUID userId = authUser.userId(); setToActive(userId); - final CreateUserResult lambdaUser = authenticationService.createUser("lambda", "xxxxxxxx", "lamnda@inrae.fr"); + try { + final CreateUserResult lambdaUser = authenticationService.createUser("lambda", "xxxxxxxx", "lamnda@inrae.fr"); + } catch (AuthenticationFailure e) { + log.info("L'utilisateur existe déjà .... login"); + } authCookie = mockMvc.perform(post("/api/v1/login") .param("login", "poussin") .param("password", "xxxxxxxx")) -- GitLab From 53488a2a20caac618763ec0b16b60ef2966881d6 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Tue, 25 Feb 2025 11:08:20 +0100 Subject: [PATCH 12/14] Modification du profile no-tags --- pom.xml | 6 +++--- .../oresing/rest/ApplicationConfigurationServiceTest.java | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 002f5c6..972be43 100644 --- a/pom.xml +++ b/pom.xml @@ -769,13 +769,13 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> - <excludeTags> - core.basic,core.config,core.auth, + <excludedGroups> + SUITE,core.basic,core.config,core.auth, domain.model,domain.checker,domain.i18n, integration.rest,integration.persistence, app.monsoere,app.haute_frequence,app.acbb, app.olac,app.foret,app.pattern,app.recursivity,app.teledetection - </excludeTags> + </excludedGroups> </configuration> </plugin> </plugins> diff --git a/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java b/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java index 1e7b513..c22327b 100644 --- a/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java +++ b/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java @@ -16,7 +16,6 @@ import fr.inra.oresing.rest.services.ApplicationConfigurationService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -- GitLab From 0942dc5772fa46386986f39f0aaa25c08cc28366 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Tue, 25 Feb 2025 11:18:09 +0100 Subject: [PATCH 13/14] Suppression de message d'erreur --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 972be43..721908f 100644 --- a/pom.xml +++ b/pom.xml @@ -769,6 +769,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> + <argLine>-XX:+EnableDynamicAgentLoading</argLine> <excludedGroups> SUITE,core.basic,core.config,core.auth, domain.model,domain.checker,domain.i18n, -- GitLab From 607e01985a390e2167826008d980cd58ed944da4 Mon Sep 17 00:00:00 2001 From: philippe tcheriatinsky <philippe.tcherniatinsky@inrae.fr> Date: Tue, 25 Feb 2025 12:44:33 +0100 Subject: [PATCH 14/14] =?UTF-8?q?correction=20TestReferencesErrors=20si=20?= =?UTF-8?q?l'utilisateur=20existe=20d=C3=A9j=C3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oresing/rest/TestReferencesErrors.java | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java b/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java index 5a6642e..2147929 100644 --- a/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java +++ b/src/test/java/fr/inra/oresing/rest/TestReferencesErrors.java @@ -7,6 +7,7 @@ import fr.inra.oresing.TestDatabaseConfig; import fr.inra.oresing.persistence.AuthenticationFailure; import fr.inra.oresing.persistence.AuthenticationService; import fr.inra.oresing.persistence.JsonRowMapper; +import fr.inra.oresing.rest.model.authorization.LoginAdminResult; import lombok.extern.slf4j.Slf4j; import org.hamcrest.Matchers; import org.hamcrest.core.IsEqual; @@ -71,7 +72,8 @@ public class TestReferencesErrors { @Autowired private NamedParameterJdbcTemplate namedParameterJdbcTemplate; private Cookie authCookie; - + private static CreateUserResult authUser = null; + private static UUID userId; @AfterAll public static void registerErrors() throws IOException { String errorsAsString = new ObjectMapper().writeValueAsString(responses); @@ -84,11 +86,19 @@ public class TestReferencesErrors { @BeforeEach public void createUser() throws Exception { - CreateUserResult authUser = authenticationService.createUser("poussin", "xxxxxxxx", "poussin@inrae.fr"); - final UUID userId = authUser.userId(); - setToActive(userId); try { - final CreateUserResult lambdaUser = authenticationService.createUser("lambda", "xxxxxxxx", "lamnda@inrae.fr"); + authUser = authenticationService.createUser("poussin", "xxxxxxxx", "poussin@inrae.fr"); + userId = authUser.userId(); + setToActive(authUser.userId()); + } catch (AuthenticationFailure e) { + LoginAdminResult login = authenticationService.login("poussin", "xxxxxxxx"); + authUser = CreateUserResult.of(authenticationService.getByIdOrLogin(login.id().toString())); + userId = authUser.userId(); + setToActive(authUser.userId()); + log.info("L'utilisateur existe déjà .... login"); + } + try { + authenticationService.createUser("lambda", "xxxxxxxx", "lamnda@inrae.fr"); } catch (AuthenticationFailure e) { log.info("L'utilisateur existe déjà .... login"); } @@ -122,17 +132,6 @@ public class TestReferencesErrors { namedParameterJdbcTemplate.update(sql, Map.of("id", userId)); } - @Transactional - void setToActive(final String login) { - String sql = """ - UPDATE public.oresiuser - SET accountstate = 'active' - WHERE login = :login - """; - - namedParameterJdbcTemplate.update(sql, Map.of("login", login)); - } - @Test public void testRecursivity() throws Exception { -- GitLab