Package org.sonar.core.qualitygate.db

Examples of org.sonar.core.qualitygate.db.QualityGateConditionDto


    }
    return metric;
  }

  private QualityGateConditionDto getNonNullCondition(long id) {
    QualityGateConditionDto condition = conditionDao.selectById(id);
    if (condition == null) {
      throw new NotFoundException("There is no condition with id=" + id);
    }
    return condition;
  }
View Full Code Here


  @Test
  public void show_by_id_nominal() throws Exception {
    long gateId = 12345L;
    when(qGates.get(gateId)).thenReturn(new QualityGateDto().setId(gateId).setName("Golden"));
    when(qGates.listConditions(gateId)).thenReturn(ImmutableList.of(
      new QualityGateConditionDto().setId(1L).setMetricKey("ncloc").setOperator("GT").setErrorThreshold("10000"),
      new QualityGateConditionDto().setId(2L).setMetricKey("new_coverage").setOperator("LT").setWarningThreshold("90").setPeriod(3)
      ));
    tester.newGetRequest("api/qualitygates", "show").setParam("id", Long.toString(gateId)).execute().assertJson(
      "{'id':12345,'name':'Golden','conditions':["
        + "{'id':1,'metric':'ncloc','op':'GT','error':'10000'},"
        + "{'id':2,'metric':'new_coverage','op':'LT','warning':'90','period':3}"
View Full Code Here

  public void show_by_name_nominal() throws Exception {
    long qGateId = 12345L;
    String gateName = "Golden";
    when(qGates.get(gateName)).thenReturn(new QualityGateDto().setId(qGateId).setName(gateName));
    when(qGates.listConditions(qGateId)).thenReturn(ImmutableList.of(
      new QualityGateConditionDto().setId(1L).setMetricKey("ncloc").setOperator("GT").setErrorThreshold("10000"),
      new QualityGateConditionDto().setId(2L).setMetricKey("new_coverage").setOperator("LT").setWarningThreshold("90").setPeriod(3)
      ));
    tester.newGetRequest("api/qualitygates", "show").setParam("name", gateName).execute().assertJson(
      "{'id':12345,'name':'Golden','conditions':["
        + "{'id':1,'metric':'ncloc','op':'GT','error':'10000'},"
        + "{'id':2,'metric':'new_coverage','op':'LT','warning':'90','period':3}"
View Full Code Here

    String metricKey = "coverage";
    String operator = "LT";
    String warningThreshold = "80";
    String errorThreshold = "75";
    when(qGates.createCondition(qGateId, metricKey, operator, warningThreshold, errorThreshold, null))
      .thenReturn(new QualityGateConditionDto().setId(12345L).setQualityGateId(qGateId).setMetricId(10).setMetricKey(metricKey)
        .setOperator(operator).setWarningThreshold(warningThreshold).setErrorThreshold(errorThreshold));
    tester.newGetRequest("api/qualitygates", "create_condition")
      .setParam("gateId", Long.toString(qGateId))
      .setParam("metric", metricKey)
      .setParam("op", operator)
View Full Code Here

    String metricKey = "coverage";
    String operator = "LT";
    String warningThreshold = "80";
    String errorThreshold = "75";
    when(qGates.updateCondition(condId, metricKey, operator, warningThreshold, errorThreshold, null))
      .thenReturn(new QualityGateConditionDto().setId(condId).setMetricId(10).setMetricKey(metricKey)
        .setOperator(operator).setWarningThreshold(warningThreshold).setErrorThreshold(errorThreshold));
    tester.newGetRequest("api/qualitygates", "update_condition")
      .setParam("id", Long.toString(condId))
      .setParam("metric", metricKey)
      .setParam("op", operator)
View Full Code Here

TOP

Related Classes of org.sonar.core.qualitygate.db.QualityGateConditionDto

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.