From fae32704fba2278d188b9513a37aada26f33009d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lamotte Date: Tue, 26 Mar 2019 01:20:56 +0100 Subject: [PATCH] Fix API usage for sonar 7.7 --- pom.xml | 5 ++++- .../com/talanlabs/sonar/plugins/gitlab/CommitFacade.java | 4 ++-- .../sonar/plugins/gitlab/GitLabPluginConfiguration.java | 4 ++-- .../com/talanlabs/sonar/plugins/gitlab/MarkDownUtils.java | 4 ++-- .../com/talanlabs/sonar/plugins/gitlab/ReporterBuilder.java | 2 +- .../java/com/talanlabs/sonar/plugins/gitlab/SonarFacade.java | 4 ++-- .../com/talanlabs/sonar/plugins/gitlab/SonarFacadeTest.java | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index cc1ff17..72273d7 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ gabriel.allaigre@gmail.com Talanlabs - 7.0 + 7.7 GitLab com.talanlabs.sonar.plugins.gitlab.GitLabPlugin @@ -83,6 +83,9 @@ David Marin Vaquero + + Jean-Baptiste Lamotte + https://github.com/gabrie-allaigre/sonar-gitlab-plugin diff --git a/src/main/java/com/talanlabs/sonar/plugins/gitlab/CommitFacade.java b/src/main/java/com/talanlabs/sonar/plugins/gitlab/CommitFacade.java index 37f0c25..82ed066 100644 --- a/src/main/java/com/talanlabs/sonar/plugins/gitlab/CommitFacade.java +++ b/src/main/java/com/talanlabs/sonar/plugins/gitlab/CommitFacade.java @@ -22,7 +22,7 @@ import com.google.common.annotations.VisibleForTesting; import com.talanlabs.sonar.plugins.gitlab.models.JsonMode; import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; import org.sonar.api.scan.filesystem.PathResolver; import org.sonar.api.utils.MessageException; import org.sonar.api.utils.log.Logger; @@ -41,7 +41,7 @@ /** * Facade for all WS interaction with GitLab. */ -@InstantiationStrategy(InstantiationStrategy.PER_BATCH) +@InstantiationStrategy(InstantiationStrategy.PER_PROJECT) @ScannerSide public class CommitFacade { diff --git a/src/main/java/com/talanlabs/sonar/plugins/gitlab/GitLabPluginConfiguration.java b/src/main/java/com/talanlabs/sonar/plugins/gitlab/GitLabPluginConfiguration.java index 5f99e3d..9396f94 100644 --- a/src/main/java/com/talanlabs/sonar/plugins/gitlab/GitLabPluginConfiguration.java +++ b/src/main/java/com/talanlabs/sonar/plugins/gitlab/GitLabPluginConfiguration.java @@ -24,7 +24,7 @@ import com.talanlabs.sonar.plugins.gitlab.models.StatusNotificationsMode; import org.sonar.api.CoreProperties; import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; import org.sonar.api.batch.rule.Severity; import org.sonar.api.config.Configuration; import org.sonar.api.utils.System2; @@ -36,7 +36,7 @@ import java.util.Arrays; import java.util.List; -@InstantiationStrategy(InstantiationStrategy.PER_BATCH) +@InstantiationStrategy(InstantiationStrategy.PER_PROJECT) @ScannerSide public class GitLabPluginConfiguration { diff --git a/src/main/java/com/talanlabs/sonar/plugins/gitlab/MarkDownUtils.java b/src/main/java/com/talanlabs/sonar/plugins/gitlab/MarkDownUtils.java index ecc4acc..f277e86 100644 --- a/src/main/java/com/talanlabs/sonar/plugins/gitlab/MarkDownUtils.java +++ b/src/main/java/com/talanlabs/sonar/plugins/gitlab/MarkDownUtils.java @@ -20,12 +20,12 @@ package com.talanlabs.sonar.plugins.gitlab; import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; import org.sonar.api.batch.rule.Severity; import javax.annotation.Nullable; -@InstantiationStrategy(InstantiationStrategy.PER_BATCH) +@InstantiationStrategy(InstantiationStrategy.PER_PROJECT) @ScannerSide public class MarkDownUtils { diff --git a/src/main/java/com/talanlabs/sonar/plugins/gitlab/ReporterBuilder.java b/src/main/java/com/talanlabs/sonar/plugins/gitlab/ReporterBuilder.java index 2f377a8..c11d8b9 100644 --- a/src/main/java/com/talanlabs/sonar/plugins/gitlab/ReporterBuilder.java +++ b/src/main/java/com/talanlabs/sonar/plugins/gitlab/ReporterBuilder.java @@ -22,7 +22,7 @@ import com.talanlabs.sonar.plugins.gitlab.models.*; import org.sonar.api.ExtensionPoint; import org.sonar.api.batch.AnalysisMode; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; import org.sonar.api.batch.rule.Severity; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; diff --git a/src/main/java/com/talanlabs/sonar/plugins/gitlab/SonarFacade.java b/src/main/java/com/talanlabs/sonar/plugins/gitlab/SonarFacade.java index a635dcf..27410d2 100644 --- a/src/main/java/com/talanlabs/sonar/plugins/gitlab/SonarFacade.java +++ b/src/main/java/com/talanlabs/sonar/plugins/gitlab/SonarFacade.java @@ -28,7 +28,7 @@ import com.talanlabs.sonar.plugins.gitlab.models.Rule; import org.sonar.api.CoreProperties; import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; import org.sonar.api.batch.rule.Severity; import org.sonar.api.config.Configuration; import org.sonar.api.measures.CoreMetrics; @@ -53,7 +53,7 @@ /** * Facade for all WS interaction with Sonar */ -@InstantiationStrategy(InstantiationStrategy.PER_BATCH) +@InstantiationStrategy(InstantiationStrategy.PER_PROJECT) @ScannerSide public class SonarFacade { diff --git a/src/test/java/com/talanlabs/sonar/plugins/gitlab/SonarFacadeTest.java b/src/test/java/com/talanlabs/sonar/plugins/gitlab/SonarFacadeTest.java index 34d6cb2..9f8b912 100644 --- a/src/test/java/com/talanlabs/sonar/plugins/gitlab/SonarFacadeTest.java +++ b/src/test/java/com/talanlabs/sonar/plugins/gitlab/SonarFacadeTest.java @@ -374,7 +374,7 @@ public void tesFailed1GetNewIssue() throws IOException { createReportTaskFile(); Assertions.assertThatThrownBy(() -> sonarFacade.getNewIssues()).isInstanceOf(HttpException.class) - .hasMessage("Error 404 on http://" + sonar.getHostName() + ":" + sonar.getPort() + "/api/issues/search?componentKeys=com.talanlabs:avatar-generator-parent&p=1&resolved=false : Not Found"); + .hasMessage("Error 404 on http://" + sonar.getHostName() + ":" + sonar.getPort() + "/api/issues/search?componentKeys=com.talanlabs%3Aavatar-generator-parent&p=1&resolved=false : Not Found"); } @Test