diff --git a/pom.xml b/pom.xml index 9a15a96..8abc972 100644 --- a/pom.xml +++ b/pom.xml @@ -494,6 +494,7 @@ true 9000 + diff --git a/src/it/java/io/ecocode/java/integration/tests/LaunchSonarqubeAndBuildProjectIT.java b/src/it/java/io/ecocode/java/integration/tests/LaunchSonarqubeAndBuildProjectIT.java index 279e141..d4452b6 100644 --- a/src/it/java/io/ecocode/java/integration/tests/LaunchSonarqubeAndBuildProjectIT.java +++ b/src/it/java/io/ecocode/java/integration/tests/LaunchSonarqubeAndBuildProjectIT.java @@ -74,7 +74,7 @@ private static void launchSonarqube() { } @BeforeAll - static void setup() { + static void setup() throws InterruptedException { LOGGER.log( INFO, "\n" + @@ -102,8 +102,20 @@ static void setup() { ) .collect(Collectors.joining("\n", "\n\n", "\n\n")) ); + LOGGER.log(INFO, "----------"); + LOGGER.log(INFO, "----- DDC ----- SonarQube starting ... Waiting 5 seconds before starting ..."); + LOGGER.log(INFO, "----------"); + Thread.sleep(5000); launchSonarqube(); + LOGGER.log(INFO, "----------"); + LOGGER.log(INFO, "----- DDC ----- SonarQube server started. Waiting 5 seconds before launching analysis..."); + LOGGER.log(INFO, "----------"); + Thread.sleep(5000); launchAnalysis(); + LOGGER.log(INFO, "----------"); + LOGGER.log(INFO, "----- DDC ----- Analysis done. Waiting 5 seconds before running tests..."); + LOGGER.log(INFO, "----------"); + Thread.sleep(5000); } private static void launchAnalysis() { @@ -125,7 +137,7 @@ private static void launchAnalysis() { } @Test - void test() { + void test() throws InterruptedException { String projectKey = analyzedProjects.get(0).projectKey; Map measures = getMeasures(projectKey); @@ -136,7 +148,14 @@ void test() { List projectIssues = issuesForComponent(projectKey); assertThat(projectIssues).isNotEmpty(); - List issuesForArrayCopyCheck = issuesForFile(projectKey, "src/main/java/fr/greencodeinitiative/java/checks/AvoidGettingSizeCollectionInForLoopIgnored.java"); + String file = "src/main/java/fr/greencodeinitiative/java/checks/AvoidGettingSizeCollectionInForLoopIgnored.java"; + List issuesForArrayCopyCheck = issuesForFile(projectKey, file); + + LOGGER.log(INFO, "----------"); + LOGGER.log(INFO, () -> MessageFormat.format("----- DDC ----- Issues for file {0} : ", file)); + LOGGER.log(INFO, () -> MessageFormat.format("{0}", issuesForArrayCopyCheck)); + LOGGER.log(INFO, "----------"); + Thread.sleep(5000); assertThat(issuesForArrayCopyCheck) .hasSize(1) @@ -153,6 +172,9 @@ void test() { assertThat(issue.getEffort()).isEqualTo("5min"); assertThat(issue.getType()).isEqualTo(CODE_SMELL); }); + + LOGGER.log(INFO, "DDC - Test done. Waiting 5 seconds before stopping SonarQube server..."); + Thread.sleep(5000); } @AfterAll