diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-07-18 18:01:10 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-07-18 18:02:10 +0200 |
commit | e93420742f6d1361b5043eb56b15cbdbf7d00690 (patch) | |
tree | 5e457115e3fb272bafceb399802d79f1f860aa42 /sonar-batch | |
parent | 29fc472ef063094907dca7b71f443036dd623ea6 (diff) | |
download | sonarqube-e93420742f6d1361b5043eb56b15cbdbf7d00690.tar.gz sonarqube-e93420742f6d1361b5043eb56b15cbdbf7d00690.zip |
SONAR-5417 Need bestValue and optimizedBestValue on metric in batch protocol
Diffstat (limited to 'sonar-batch')
3 files changed, 8 insertions, 3 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/AnalyzerMediumTester.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/AnalyzerMediumTester.java index fcd22b383ef..f20917fe971 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/AnalyzerMediumTester.java +++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/AnalyzerMediumTester.java @@ -245,7 +245,7 @@ public class AnalyzerMediumTester { } public FakeProjectReferentialsLoader add(Metric metric) { - ref.metrics().add(new org.sonar.batch.protocol.input.Metric(metricId, metric.key(), metric.getType().name())); + ref.metrics().add(new org.sonar.batch.protocol.input.Metric(metricId, metric.key(), metric.getType().name(), metric.getBestValue(), metric.isOptimizedBestValue())); metricId++; return this; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java b/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java index 31fe1ff4ced..8467e5573d6 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java +++ b/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java @@ -71,7 +71,7 @@ public class DefaultProjectReferentialsLoader implements ProjectReferentialsLoad public ProjectReferentials load(ProjectReactor reactor, Settings settings, Languages languages) { ProjectReferentials ref = new ProjectReferentials(); for (Metric m : sessionFactory.getSession().getResults(Metric.class, ENABLED, true)) { - ref.metrics().add(new org.sonar.batch.protocol.input.Metric(m.getId(), m.getKey(), m.getType().name())); + ref.metrics().add(new org.sonar.batch.protocol.input.Metric(m.getId(), m.getKey(), m.getType().name(), m.getBestValue(), m.isOptimizedBestValue())); } String defaultName = settings.getString(ModuleQProfiles.SONAR_PROFILE_PROP); diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java index 00d8403a473..495eaef2e56 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java @@ -37,7 +37,12 @@ public final class DeprecatedMetricFinder implements MetricFinder { public DeprecatedMetricFinder(ProjectReferentials projectReferentials) { for (org.sonar.batch.protocol.input.Metric metric : projectReferentials.metrics()) { - metricsByKey.put(metric.key(), new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), ValueType.valueOf(metric.valueType())).create().setId(metric.id())); + Metric hibernateMetric = new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), ValueType.valueOf(metric.valueType())) + .setBestValue(metric.bestValue()) + .setOptimizedBestValue(metric.isOptimizedBestValue()) + .create() + .setId(metric.id()); + metricsByKey.put(metric.key(), hibernateMetric); metricsById.put(metric.id(), new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), ValueType.valueOf(metric.valueType())).create().setId(metric.id())); } } |