aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-12-02 17:36:54 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-12-03 08:43:18 +0100
commit70e0f84f971e5a6adb79613c956584116e129318 (patch)
tree0e22e8f448d044a9473d8120cfaf09f6fbd1a969
parentc93d2bf659c5fc869b05752789e2bb267a9decc5 (diff)
downloadsonarqube-70e0f84f971e5a6adb79613c956584116e129318.tar.gz
sonarqube-70e0f84f971e5a6adb79613c956584116e129318.zip
SONAR-7027 add&retrieve raw measure for dev in MeasureRepositoryRule
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java
index 9f0e09422c4..f62de9218e2 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureRepositoryRule.java
@@ -35,6 +35,7 @@ import org.junit.rules.ExternalResource;
import org.sonar.server.computation.component.Component;
import org.sonar.server.computation.component.ComponentProvider;
import org.sonar.server.computation.component.Developer;
+import org.sonar.server.computation.component.DumbDeveloper;
import org.sonar.server.computation.component.NoComponentProvider;
import org.sonar.server.computation.component.TreeComponentProvider;
import org.sonar.server.computation.component.TreeRootHolder;
@@ -232,7 +233,7 @@ public class MeasureRepositoryRule extends ExternalResource implements MeasureRe
checkAndInitProvidersState();
InternalKey internalKey = new InternalKey(componentProvider.getByRef(componentRef), metricRepositoryRule.getByKey(metricKey), measure.getRuleId(),
- measure.getCharacteristicId());
+ measure.getCharacteristicId(), measure.getDeveloper());
checkState(!rawMeasures.containsKey(internalKey), format(
"A measure can only be set once for Component (ref=%s), Metric (key=%s), ruleId=%s, characteristicId=%s",
componentRef, metricKey, measure.getRuleId(), measure.getCharacteristicId()));
@@ -253,6 +254,10 @@ public class MeasureRepositoryRule extends ExternalResource implements MeasureRe
return Optional.fromNullable(rawMeasures.get(new InternalKey(component, metric)));
}
+ public Optional<Measure> getRawMeasure(Component component, Metric metric, DumbDeveloper developer) {
+ return Optional.fromNullable(rawMeasures.get(new InternalKey(component, metric, null, null, developer)));
+ }
+
public Optional<Measure> getRawRuleMeasure(Component component, Metric metric, int ruleId) {
return Optional.fromNullable(rawMeasures.get(new InternalKey(component, metric, ruleId, null)));
}
@@ -330,7 +335,11 @@ public class MeasureRepositoryRule extends ExternalResource implements MeasureRe
this(getRef(component), metric.getKey(), ruleId, characteristicId, null);
}
- public InternalKey(String componentRef, String metricKey, @Nullable Integer ruleId, @Nullable Integer characteristicId, @Nullable Developer developer) {
+ public InternalKey(Component component, Metric metric, @Nullable Integer ruleId, @Nullable Integer characteristicId, @Nullable Developer developer) {
+ this(getRef(component), metric.getKey(), ruleId, characteristicId, null);
+ }
+
+ private InternalKey(String componentRef, String metricKey, @Nullable Integer ruleId, @Nullable Integer characteristicId, @Nullable Developer developer) {
this.componentRef = componentRef;
this.metricKey = metricKey;
this.ruleId = ruleId == null ? DEFAULT_VALUE : ruleId;