aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-12-04 11:41:15 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-12-07 17:26:43 +0100
commit6cf62f0adc9677404df3ff457135591c17ad89a5 (patch)
tree08b31db10e52e92575a6343768f93e46b13266b7 /sonar-batch
parent541c15654fc024534c45710b30b9cfc8ec551d96 (diff)
downloadsonarqube-6cf62f0adc9677404df3ff457135591c17ad89a5.tar.gz
sonarqube-6cf62f0adc9677404df3ff457135591c17ad89a5.zip
SONAR-6939 ability for plugins to override the decimal scale of float
measures
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java68
1 files changed, 0 insertions, 68 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java
index b78239bac82..9212cc46512 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java
@@ -35,8 +35,6 @@ import org.sonar.batch.mediumtest.BatchMediumTester;
import org.sonar.batch.mediumtest.TaskResult;
import org.sonar.batch.protocol.output.BatchReport.Measure;
import org.sonar.xoo.XooPlugin;
-import org.sonar.xoo.measures.ConstantFloatMeasureSensor;
-import org.sonar.xoo.measures.XooMetrics;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
@@ -52,7 +50,6 @@ public class MeasuresMediumTest {
public BatchMediumTester tester = BatchMediumTester.builder()
.registerPlugin("xoo", new XooPlugin())
.addDefaultQProfile("xoo", "Sonar Way")
- .registerMetric(XooMetrics.CONSTANT_FLOAT_MEASURE)
.build();
@Before
@@ -103,71 +100,6 @@ public class MeasuresMediumTest {
}
@Test
- public void floatMeasuresTruncatedTo1ByDefault() throws IOException {
- File xooFile = new File(srcDir, "sample.xoo");
- File xooMeasureFile = new File(srcDir, "sample.xoo.measures");
- FileUtils.write(xooFile, "Sample xoo\ncontent");
- FileUtils.write(xooMeasureFile, "lines:20");
-
- TaskResult result = tester.newTask()
- .properties(ImmutableMap.<String, String>builder()
- .put("sonar.task", "scan")
- .put("sonar.projectBaseDir", baseDir.getAbsolutePath())
- .put("sonar.projectKey", "com.foo.project")
- .put("sonar.projectName", "Foo Project")
- .put("sonar.projectVersion", "1.0-SNAPSHOT")
- .put("sonar.projectDescription", "Description of Foo Project")
- .put("sonar.sources", "src")
- .put("sonar.cpd.xoo.skip", "true")
- .put(ConstantFloatMeasureSensor.SONAR_XOO_ENABLE_FLOAT_SENSOR, "true")
- .build())
- .start();
-
- Map<String, List<Measure>> allMeasures = result.allMeasures();
-
- assertThat(allMeasures.get("com.foo.project")).extracting("metricKey", "intValue", "doubleValue", "stringValue").containsOnly(
- Tuple.tuple(CoreMetrics.QUALITY_PROFILES_KEY, 0, 0.0,
- "[{\"key\":\"Sonar Way\",\"language\":\"xoo\",\"name\":\"Sonar Way\",\"rulesUpdatedAt\":\"2009-02-13T23:31:31+0000\"}]"));
-
- assertThat(allMeasures.get("com.foo.project:src/sample.xoo")).extracting("metricKey", "intValue", "doubleValue").containsOnly(
- Tuple.tuple(CoreMetrics.LINES_KEY, 2, 0.0),
- Tuple.tuple(XooMetrics.CONSTANT_FLOAT_MEASURE_KEY, 0, 1.2));
- }
-
- @Test
- public void floatMeasuresCustomPrecision() throws IOException {
- File xooFile = new File(srcDir, "sample.xoo");
- File xooMeasureFile = new File(srcDir, "sample.xoo.measures");
- FileUtils.write(xooFile, "Sample xoo\ncontent");
- FileUtils.write(xooMeasureFile, "lines:20");
-
- TaskResult result = tester.newTask()
- .properties(ImmutableMap.<String, String>builder()
- .put("sonar.task", "scan")
- .put("sonar.projectBaseDir", baseDir.getAbsolutePath())
- .put("sonar.projectKey", "com.foo.project")
- .put("sonar.projectName", "Foo Project")
- .put("sonar.projectVersion", "1.0-SNAPSHOT")
- .put("sonar.projectDescription", "Description of Foo Project")
- .put("sonar.sources", "src")
- .put("sonar.cpd.xoo.skip", "true")
- .put(ConstantFloatMeasureSensor.SONAR_XOO_ENABLE_FLOAT_SENSOR, "true")
- .put(ConstantFloatMeasureSensor.SONAR_XOO_FLOAT_PRECISION, "5")
- .build())
- .start();
-
- Map<String, List<Measure>> allMeasures = result.allMeasures();
-
- assertThat(allMeasures.get("com.foo.project")).extracting("metricKey", "intValue", "doubleValue", "stringValue").containsOnly(
- Tuple.tuple(CoreMetrics.QUALITY_PROFILES_KEY, 0, 0.0,
- "[{\"key\":\"Sonar Way\",\"language\":\"xoo\",\"name\":\"Sonar Way\",\"rulesUpdatedAt\":\"2009-02-13T23:31:31+0000\"}]"));
-
- assertThat(allMeasures.get("com.foo.project:src/sample.xoo")).extracting("metricKey", "intValue", "doubleValue").containsOnly(
- Tuple.tuple(CoreMetrics.LINES_KEY, 2, 0.0),
- Tuple.tuple(XooMetrics.CONSTANT_FLOAT_MEASURE_KEY, 0, 1.23457));
- }
-
- @Test
public void computeLinesOnAllFiles() throws IOException {
File xooFile = new File(srcDir, "sample.xoo");
FileUtils.write(xooFile, "Sample xoo\n\ncontent");