Package org.sonar.api.measures

Examples of org.sonar.api.measures.RuleMeasure


    setupData("empty");

    Rule rule = Rule.create("pmd", "key");
    when(ruleFinder.findByKey(rule.ruleKey())).thenReturn(rule);

    Measure measure = new RuleMeasure(ncloc(), rule, RulePriority.MAJOR, 1).setValue(1234.0);
    when(measureCache.entries()).thenReturn(Arrays.asList(new Cache.Entry<Measure>(new String[] {"foo", "ncloc"}, measure)));

    measurePersister.persist();

    checkTables("shouldInsertRuleMeasure", "project_measures");
View Full Code Here


    Issue issue1 = createIssue("rule1", "repo1").setDebt(Duration.create(ONE_DAY_IN_MINUTES));
    Issue issue2 = createIssue("rule1", "repo1").setDebt(Duration.create(ONE_DAY_IN_MINUTES));
    when(issuable.issues()).thenReturn(newArrayList(issue1, issue2));

    when(context.getChildrenMeasures(any(MeasuresFilter.class))).thenReturn(Lists.<Measure>newArrayList(
      new RuleMeasure(CoreMetrics.TECHNICAL_DEBT,
        org.sonar.api.rules.Rule.create(ruleKey1.repository(), ruleKey1.rule()), null, null)
        .setValue(5d * ONE_DAY_IN_MINUTES)
      ));
    decorator.decorate(resource, context);

View Full Code Here

  @Test
  public void add_technical_debt_only_from_children_measures() throws Exception {
    when(issuable.issues()).thenReturn(Collections.<Issue>emptyList());

    when(context.getChildrenMeasures(any(MeasuresFilter.class))).thenReturn(Lists.<Measure>newArrayList(
      new RuleMeasure(CoreMetrics.TECHNICAL_DEBT,
        org.sonar.api.rules.Rule.create(ruleKey1.repository(), ruleKey1.rule())
        , null, null).setValue(5d * ONE_DAY_IN_MINUTES),

      new RuleMeasure(CoreMetrics.TECHNICAL_DEBT,
        org.sonar.api.rules.Rule.create(ruleKey2.repository(), ruleKey2.rule())
        , null, null).setValue(10d * ONE_DAY_IN_MINUTES)
      ));
    decorator.decorate(resource, context);

View Full Code Here

    @Override
    public boolean matches(Object o) {
      if (!(o instanceof RuleMeasure)) {
        return false;
      }
      RuleMeasure m = (RuleMeasure) o;
      return ObjectUtils.equals(metric, m.getMetric()) &&
        ObjectUtils.equals(ruleKey, m.ruleKey()) &&
        ObjectUtils.equals(value, m.getValue());
    }
View Full Code Here

TOP

Related Classes of org.sonar.api.measures.RuleMeasure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.