diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-21 15:54:06 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-21 16:00:41 +0200 |
commit | fc6d8e2ddcca736718a073b1487869be2b6de5fc (patch) | |
tree | 988a935354e7553ad1bef3e4fcef5bb42795eba8 /sonar-batch | |
parent | 997932e76a9ed18ddf8534f575b39814c019ea6c (diff) | |
download | sonarqube-fc6d8e2ddcca736718a073b1487869be2b6de5fc.tar.gz sonarqube-fc6d8e2ddcca736718a073b1487869be2b6de5fc.zip |
SONAR-5319 Return SQALE Rating and SQALE Debt ratio in /api/component/app WS
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java | 4 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java index 458b1d27eb0..41b2af1fafa 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java @@ -76,7 +76,7 @@ public final class SqaleRatingDecorator implements Decorator { @DependedUpon public List<Metric> generatesMetrics() { - return Lists.<Metric>newArrayList(CoreMetrics.RATING, CoreMetrics.DEVELOPMENT_COST, CoreMetrics.SQALE_DEBT_RATIO); + return Lists.<Metric>newArrayList(CoreMetrics.SQALE_RATING, CoreMetrics.DEVELOPMENT_COST, CoreMetrics.SQALE_DEBT_RATIO); } public void decorate(Resource resource, DecoratorContext context) { @@ -94,7 +94,7 @@ public final class SqaleRatingDecorator implements Decorator { } private Measure createRatingMeasure(int rating) { - return new Measure(CoreMetrics.RATING).setIntValue(rating).setData(toRatingLetter(rating)); + return new Measure(CoreMetrics.SQALE_RATING).setIntValue(rating).setData(toRatingLetter(rating)); } static String toRatingLetter(@Nullable Integer rating) { diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java index 48a58f4a050..1b1840a8443 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java @@ -119,7 +119,7 @@ public class SqaleRatingDecoratorTest { when(context.getMeasure(CoreMetrics.TECHNICAL_DEBT)).thenReturn(new Measure(CoreMetrics.TECHNICAL_DEBT, 300.0 * ONE_DAY_IN_MINUTES)); decorator.decorate(file, context); - verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.RATING, 3.0))); + verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.SQALE_RATING, 3.0))); verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.DEVELOPMENT_COST, "9600"))); verify(context).saveMeasure(CoreMetrics.SQALE_DEBT_RATIO, 1500d); @@ -137,7 +137,7 @@ public class SqaleRatingDecoratorTest { when(context.getMeasure(CoreMetrics.TECHNICAL_DEBT)).thenReturn(new Measure(CoreMetrics.TECHNICAL_DEBT, 0.0)); decorator.decorate(file, context); - verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.RATING, 1.0))); + verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.SQALE_RATING, 1.0))); verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.DEVELOPMENT_COST, "9600"))); verify(context).saveMeasure(CoreMetrics.SQALE_DEBT_RATIO, 0d); @@ -155,7 +155,7 @@ public class SqaleRatingDecoratorTest { when(context.getMeasure(CoreMetrics.TECHNICAL_DEBT)).thenReturn(new Measure(CoreMetrics.TECHNICAL_DEBT, 960000.0)); decorator.decorate(file, context); - verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.RATING, 5.0))); + verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.SQALE_RATING, 5.0))); verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.DEVELOPMENT_COST, "9600"))); verify(context).saveMeasure(CoreMetrics.SQALE_DEBT_RATIO, 10000d); @@ -171,7 +171,7 @@ public class SqaleRatingDecoratorTest { when(context.getChildrenMeasures(CoreMetrics.DEVELOPMENT_COST)).thenReturn(newArrayList(new Measure(CoreMetrics.DEVELOPMENT_COST, Double.toString(20.0 * ONE_DAY_IN_MINUTES)))); decorator.decorate(mock(File.class), context); - verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.RATING, 3.0))); + verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.SQALE_RATING, 3.0))); verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.DEVELOPMENT_COST, "9600"))); verify(context).saveMeasure(CoreMetrics.SQALE_DEBT_RATIO, 1500d); |