aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce-task-projectanalysis
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-ce-task-projectanalysis')
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationCheck.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationChecksStep.java13
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationChecksStepTest.java12
3 files changed, 25 insertions, 4 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationCheck.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationCheck.java
index c747d892539..cda06cbb481 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationCheck.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationCheck.java
@@ -21,6 +21,7 @@ package org.sonar.ce.task.projectanalysis.measure;
import org.sonar.api.ExtensionPoint;
import org.sonar.api.ce.ComputeEngineSide;
+import org.sonar.api.config.Configuration;
import org.sonar.ce.task.projectanalysis.analysis.Branch;
/**
@@ -47,9 +48,10 @@ public interface PreMeasuresComputationCheck {
Branch getBranch();
+ Configuration getConfiguration();
}
- class PreMeasuresComputationCheckException extends Exception {
+ class PreMeasuresComputationCheckException extends RuntimeException {
public PreMeasuresComputationCheckException(String message) {
super(message);
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationChecksStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationChecksStep.java
index c88c88ae4c6..6eb936f9d11 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationChecksStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationChecksStep.java
@@ -19,10 +19,12 @@
*/
package org.sonar.ce.task.projectanalysis.measure;
+import org.sonar.api.config.Configuration;
import org.sonar.api.utils.System2;
import org.sonar.ce.task.log.CeTaskMessages;
import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder;
import org.sonar.ce.task.projectanalysis.analysis.Branch;
+import org.sonar.ce.task.projectanalysis.component.ConfigurationRepository;
import org.sonar.ce.task.step.ComputationStep;
import org.sonar.db.dismissmessage.MessageType;
@@ -38,11 +40,15 @@ public class PreMeasuresComputationChecksStep implements ComputationStep {
private final AnalysisMetadataHolder analysisMetadataHolder;
private final PreMeasuresComputationCheck[] extensions;
private final CeTaskMessages ceTaskMessages;
+ private final ConfigurationRepository configurationRepository;
- public PreMeasuresComputationChecksStep(AnalysisMetadataHolder analysisMetadataHolder, CeTaskMessages ceTaskMessages, PreMeasuresComputationCheck... extensions) {
+ public PreMeasuresComputationChecksStep(
+ AnalysisMetadataHolder analysisMetadataHolder, CeTaskMessages ceTaskMessages,
+ ConfigurationRepository configurationRepository, PreMeasuresComputationCheck... extensions) {
this.analysisMetadataHolder = analysisMetadataHolder;
this.ceTaskMessages = ceTaskMessages;
+ this.configurationRepository = configurationRepository;
this.extensions = extensions;
}
@@ -75,5 +81,10 @@ public class PreMeasuresComputationChecksStep implements ComputationStep {
return analysisMetadataHolder.getBranch();
}
+ @Override
+ public Configuration getConfiguration() {
+ return configurationRepository.getConfiguration();
+ }
+
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationChecksStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationChecksStepTest.java
index 6654d5edb1b..de68f6843df 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationChecksStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/PreMeasuresComputationChecksStepTest.java
@@ -19,12 +19,14 @@
*/
package org.sonar.ce.task.projectanalysis.measure;
+import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
import org.sonar.ce.task.log.CeTaskMessages;
import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
import org.sonar.ce.task.projectanalysis.analysis.Branch;
+import org.sonar.ce.task.projectanalysis.component.ConfigurationRepository;
import org.sonar.ce.task.projectanalysis.measure.PreMeasuresComputationCheck.Context;
import org.sonar.ce.task.step.TestComputationStepContext;
import org.sonar.db.component.BranchType;
@@ -44,6 +46,12 @@ public class PreMeasuresComputationChecksStepTest {
public AnalysisMetadataHolderRule analysisMetadataHolder = mock();
public CeTaskMessages ceTaskMessages = mock();
+ public ConfigurationRepository configurationRepository = mock();
+
+ @Before
+ public void setup() {
+
+ }
@Test
public void execute_extensions() throws PreMeasuresComputationCheckException {
@@ -114,9 +122,9 @@ public class PreMeasuresComputationChecksStepTest {
private PreMeasuresComputationChecksStep newStep(PreMeasuresComputationCheck... preMeasuresComputationChecks) {
if (preMeasuresComputationChecks.length == 0) {
- return new PreMeasuresComputationChecksStep(analysisMetadataHolder, ceTaskMessages);
+ return new PreMeasuresComputationChecksStep(analysisMetadataHolder, ceTaskMessages, configurationRepository);
}
- return new PreMeasuresComputationChecksStep(analysisMetadataHolder, ceTaskMessages, preMeasuresComputationChecks);
+ return new PreMeasuresComputationChecksStep(analysisMetadataHolder, ceTaskMessages, configurationRepository, preMeasuresComputationChecks);
}
private void mockBranch(String branchName) {