Search in sources :

Example 36 with MeasureDto

use of org.sonar.db.measure.MeasureDto in project sonarqube by SonarSource.

the class ComponentTreeSortTest method setUp.

@Before
public void setUp() {
    components = newArrayList(newComponentWithoutSnapshotId("name-1", "qualifier-2", "path-9"), newComponentWithoutSnapshotId("name-3", "qualifier-3", "path-8"), newComponentWithoutSnapshotId("name-2", "qualifier-4", "path-7"), newComponentWithoutSnapshotId("name-4", "qualifier-5", "path-6"), newComponentWithoutSnapshotId("name-7", "qualifier-6", "path-5"), newComponentWithoutSnapshotId("name-6", "qualifier-7", "path-4"), newComponentWithoutSnapshotId("name-5", "qualifier-8", "path-3"), newComponentWithoutSnapshotId("name-9", "qualifier-9", "path-2"), newComponentWithoutSnapshotId("name-8", "qualifier-1", "path-1"));
    MetricDto violationsMetric = newMetricDto().setKey(NUM_METRIC_KEY).setValueType(ValueType.INT.name());
    MetricDto sqaleIndexMetric = newMetricDto().setKey(TEXT_METRIC_KEY).setValueType(ValueType.DATA.name());
    metrics = newArrayList(violationsMetric, sqaleIndexMetric);
    measuresByComponentUuidAndMetric = HashBasedTable.create(components.size(), 2);
    // same number than path field
    double currentValue = 9;
    for (ComponentDto component : components) {
        measuresByComponentUuidAndMetric.put(component.uuid(), violationsMetric, new MeasureDto().setValue(currentValue).setVariation(-currentValue));
        measuresByComponentUuidAndMetric.put(component.uuid(), sqaleIndexMetric, new MeasureDto().setData(String.valueOf(currentValue)));
        currentValue--;
    }
}
Also used : MeasureDto(org.sonar.db.measure.MeasureDto) MetricTesting.newMetricDto(org.sonar.db.metric.MetricTesting.newMetricDto) MetricDto(org.sonar.db.metric.MetricDto) ComponentDto(org.sonar.db.component.ComponentDto) Before(org.junit.Before)

Aggregations

MeasureDto (org.sonar.db.measure.MeasureDto)36 Test (org.junit.Test)21 MetricDto (org.sonar.db.metric.MetricDto)9 ComponentDto (org.sonar.db.component.ComponentDto)7 MeasureQuery (org.sonar.db.measure.MeasureQuery)6 DbSession (org.sonar.db.DbSession)4 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)3 SnapshotDto (org.sonar.db.component.SnapshotDto)3 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 CheckForNull (javax.annotation.CheckForNull)1 Nonnull (javax.annotation.Nonnull)1 Before (org.junit.Before)1 JsonWriter (org.sonar.api.utils.text.JsonWriter)1 ComponentLinkDto (org.sonar.db.component.ComponentLinkDto)1 ComponentTreeQuery (org.sonar.db.component.ComponentTreeQuery)1 MeasureTreeQuery (org.sonar.db.measure.MeasureTreeQuery)1 MetricTesting.newMetricDto (org.sonar.db.metric.MetricTesting.newMetricDto)1 Developer (org.sonar.server.computation.task.projectanalysis.component.Developer)1