Search in sources :

Example 1 with CountBindingWsResponse

use of org.sonarqube.ws.AlmSettings.CountBindingWsResponse in project sonarqube by SonarSource.

the class CountBindingAction method handle.

@Override
public void handle(Request request, Response response) throws Exception {
    userSession.checkIsSystemAdministrator();
    CountBindingWsResponse wsResponse = doHandle(request);
    writeProtobuf(wsResponse, request, response);
}
Also used : CountBindingWsResponse(org.sonarqube.ws.AlmSettings.CountBindingWsResponse)

Example 2 with CountBindingWsResponse

use of org.sonarqube.ws.AlmSettings.CountBindingWsResponse in project sonarqube by SonarSource.

the class CountBindingActionTest method count_github_binding.

@Test
public void count_github_binding() {
    UserDto user = db.users().insertUser();
    userSession.logIn(user).setSystemAdministrator();
    AlmSettingDto almSetting = db.almSettings().insertGitHubAlmSetting();
    ProjectDto project1 = db.components().insertPrivateProjectDto();
    ProjectDto project2 = db.components().insertPrivateProjectDto();
    db.almSettings().insertGitHubProjectAlmSetting(almSetting, project1);
    db.almSettings().insertGitHubProjectAlmSetting(almSetting, project2);
    CountBindingWsResponse response = ws.newRequest().setParam("almSetting", almSetting.getKey()).executeProtobuf(CountBindingWsResponse.class);
    assertThat(response.getKey()).isEqualTo(almSetting.getKey());
    assertThat(response.getProjects()).isEqualTo(2);
}
Also used : ProjectDto(org.sonar.db.project.ProjectDto) UserDto(org.sonar.db.user.UserDto) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) CountBindingWsResponse(org.sonarqube.ws.AlmSettings.CountBindingWsResponse) Test(org.junit.Test)

Example 3 with CountBindingWsResponse

use of org.sonarqube.ws.AlmSettings.CountBindingWsResponse in project sonarqube by SonarSource.

the class CountBindingActionTest method count_azure_binding.

@Test
public void count_azure_binding() {
    UserDto user = db.users().insertUser();
    userSession.logIn(user).setSystemAdministrator();
    AlmSettingDto almSetting = db.almSettings().insertAzureAlmSetting();
    ProjectDto project1 = db.components().insertPrivateProjectDto();
    db.almSettings().insertAzureProjectAlmSetting(almSetting, project1);
    CountBindingWsResponse response = ws.newRequest().setParam("almSetting", almSetting.getKey()).executeProtobuf(CountBindingWsResponse.class);
    assertThat(response.getKey()).isEqualTo(almSetting.getKey());
    assertThat(response.getProjects()).isOne();
}
Also used : ProjectDto(org.sonar.db.project.ProjectDto) UserDto(org.sonar.db.user.UserDto) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) CountBindingWsResponse(org.sonarqube.ws.AlmSettings.CountBindingWsResponse) Test(org.junit.Test)

Aggregations

CountBindingWsResponse (org.sonarqube.ws.AlmSettings.CountBindingWsResponse)3 Test (org.junit.Test)2 AlmSettingDto (org.sonar.db.alm.setting.AlmSettingDto)2 ProjectDto (org.sonar.db.project.ProjectDto)2 UserDto (org.sonar.db.user.UserDto)2