use of org.sonarqube.ws.WsQualityGates.CreateWsResponse in project sonarqube by SonarSource.
the class CreateActionTest method create_quality_gate.
@Test
public void create_quality_gate() throws Exception {
logInAsQualityGateAdmin();
CreateWsResponse response = executeRequest("Default");
assertThat(response.getName()).isEqualTo("Default");
assertThat(response.getId()).isNotNull();
dbSession.commit();
QualityGateDto qualityGateDto = dbClient.qualityGateDao().selectByName(dbSession, "Default");
assertThat(qualityGateDto).isNotNull();
}
use of org.sonarqube.ws.WsQualityGates.CreateWsResponse in project sonarqube by SonarSource.
the class CreateAction method handle.
@Override
public void handle(Request request, Response response) {
userSession.checkPermission(OrganizationPermission.ADMINISTER_QUALITY_GATES, defaultOrganizationProvider.get().getUuid());
try (DbSession dbSession = dbClient.openSession(false)) {
QualityGateDto newQualityGate = qualityGateUpdater.create(dbSession, request.mandatoryParam(PARAM_NAME));
CreateWsResponse.Builder createWsResponse = CreateWsResponse.newBuilder().setId(newQualityGate.getId()).setName(newQualityGate.getName());
writeProtobuf(createWsResponse.build(), request, response);
dbSession.commit();
}
}
Aggregations