Package org.sonar.core.qualitygate.db

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


      .setExampleValue("My Quality Gate");
  }

  @Override
  public void handle(Request request, Response response) {
    QualityGateDto newQualityGate = qualityGates.copy(QGatesWs.parseId(request, QGatesWs.PARAM_ID), request.mandatoryParam(QGatesWs.PARAM_NAME));
    JsonWriter writer = response.newJsonWriter();
    QGatesWs.writeQualityGate(newQualityGate, writer).close();
  }
View Full Code Here


      .setExampleValue("My Quality Gate");
  }

  @Override
  public void handle(Request request, Response response) {
    QualityGateDto newQualityGate = qualityGates.create(request.mandatoryParam(QGatesWs.PARAM_NAME));
    JsonWriter writer = response.newJsonWriter();
    QGatesWs.writeQualityGate(newQualityGate, writer).close();
  }
View Full Code Here

  public void handle(Request request, Response response) {
    Long qGateId = request.paramAsLong(QGatesWs.PARAM_ID);
    String qGateName = request.param(QGatesWs.PARAM_NAME);
    checkOneOfIdOrNamePresent(qGateId, qGateName);

    QualityGateDto qGate = qGateId == null ? qualityGates.get(qGateName) : qualityGates.get(qGateId);
    qGateId = qGate.getId();

    JsonWriter writer = response.newJsonWriter().beginObject()
      .prop(QGatesWs.PARAM_ID, qGate.getId())
      .prop(QGatesWs.PARAM_NAME, qGate.getName());
    Collection<QualityGateConditionDto> conditions = qualityGates.listConditions(qGateId);
    if (!conditions.isEmpty()) {
      writer.name("conditions").beginArray();
      for (QualityGateConditionDto condition : conditions) {
        QGatesWs.writeQualityGateCondition(condition, writer);
View Full Code Here

  }

  @Override
  public void handle(Request request, Response response) {
    long idToRename = QGatesWs.parseId(request, QGatesWs.PARAM_ID);
    QualityGateDto renamedQualityGate = qualityGates.rename(idToRename, request.mandatoryParam(QGatesWs.PARAM_NAME));
    JsonWriter writer = response.newJsonWriter();
    QGatesWs.writeQualityGate(renamedQualityGate, writer).close();
  }
View Full Code Here

  }

  @Test
  public void create_nominal() throws Exception {
    String name = "New QG";
    when(qGates.create(name)).thenReturn(new QualityGateDto().setId(42L).setName(name));
    tester.newGetRequest("api/qualitygates", "create").setParam("name", name).execute()
      .assertJson("{'id':42,'name':'New QG'}");
  }
View Full Code Here

  }

  @Test
  public void copy_nominal() throws Exception {
    String name = "Copied QG";
    when(qGates.copy(24L, name)).thenReturn(new QualityGateDto().setId(42L).setName(name));
    tester.newGetRequest("api/qualitygates", "copy").setParam("id", "24").setParam("name", name).execute()
      .assertJson("{'id':42,'name':'Copied QG'}");
  }
View Full Code Here

  @Test
  public void rename_nominal() throws Exception {
    Long id = 42L;
    String name = "New QG";
    when(qGates.rename(id, name)).thenReturn(new QualityGateDto().setId(id).setName(name));
    tester.newPostRequest("api/qualitygates", "rename").setParam("id", id.toString()).setParam("name", name).execute()
      .assertJson("{'id':42,'name':'New QG'}");
    ;
  }
View Full Code Here

  }

  @Test
  public void list_nominal() throws Exception {
    when(qGates.list()).thenReturn(Lists.newArrayList(
      new QualityGateDto().setId(42L).setName("Golden"),
      new QualityGateDto().setId(43L).setName("Star"),
      new QualityGateDto().setId(666L).setName("Ninth")
      ));
    when(qGates.currentUserHasWritePermission()).thenReturn(false);
    tester.newGetRequest("api/qualitygates", "list").execute().assertJson(
      "{'qualitygates':[{'id':42,'name':'Golden'},{'id':43,'name':'Star'},{'id':666,'name':'Ninth'}]}");
  }
View Full Code Here

      "{'qualitygates':[{'id':42,'name':'Golden'},{'id':43,'name':'Star'},{'id':666,'name':'Ninth'}]}");
  }

  @Test
  public void list_with_default() throws Exception {
    QualityGateDto defaultQgate = new QualityGateDto().setId(42L).setName("Golden");
    when(qGates.list()).thenReturn(Lists.newArrayList(
      defaultQgate,
      new QualityGateDto().setId(43L).setName("Star"),
      new QualityGateDto().setId(666L).setName("Ninth")
      ));
    when(qGates.getDefault()).thenReturn(defaultQgate);
    tester.newGetRequest("api/qualitygates", "list").execute().assertJson(
      "{'qualitygates':[{'id':42,'name':'Golden'},{'id':43,'name':'Star'},{'id':666,'name':'Ninth'}],'default':42}");
  }
View Full Code Here

  }

  @Test
  public void show_empty() throws Exception {
    long gateId = 12345L;
    when(qGates.get(gateId)).thenReturn(new QualityGateDto().setId(gateId).setName("Golden"));
    tester.newGetRequest("api/qualitygates", "show").setParam("id", Long.toString(gateId)).execute().assertJson(
      "{'id':12345,'name':'Golden'}");
  }
View Full Code Here

TOP

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

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.