Search in sources :

Example 11 with SearchAzureReposWsResponse

use of org.sonarqube.ws.AlmIntegrations.SearchAzureReposWsResponse in project sonarqube by SonarSource.

the class SearchAzureReposActionTest method search_repos.

@Test
public void search_repos() {
    AlmSettingDto almSetting = insertAlmSetting();
    SearchAzureReposWsResponse response = ws.newRequest().setParam("almSetting", almSetting.getKey()).executeProtobuf(SearchAzureReposWsResponse.class);
    assertThat(response.getRepositoriesList()).extracting(AzureRepo::getName, AzureRepo::getProjectName).containsExactlyInAnyOrder(tuple("repoName-1", "project-1"), tuple("repoName-2", "project-2"));
}
Also used : SearchAzureReposWsResponse(org.sonarqube.ws.AlmIntegrations.SearchAzureReposWsResponse) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) Test(org.junit.Test)

Example 12 with SearchAzureReposWsResponse

use of org.sonarqube.ws.AlmIntegrations.SearchAzureReposWsResponse in project sonarqube by SonarSource.

the class SearchAzureReposActionTest method search_repos_with_project_already_set_u_and_collision_is_handled.

@Test
public void search_repos_with_project_already_set_u_and_collision_is_handled() {
    AlmSettingDto almSetting = insertAlmSetting();
    ProjectDto projectDto2 = insertProject(almSetting, "repoName-2", "project-2");
    insertProject(almSetting, "repoName-2", "project-2");
    SearchAzureReposWsResponse response = ws.newRequest().setParam("almSetting", almSetting.getKey()).executeProtobuf(SearchAzureReposWsResponse.class);
    assertThat(response.getRepositoriesCount()).isEqualTo(2);
    assertThat(response.getRepositoriesList()).extracting(AzureRepo::getName, AzureRepo::getProjectName, AzureRepo::getSqProjectKey, AzureRepo::getSqProjectName).containsExactlyInAnyOrder(tuple("repoName-1", "project-1", "", ""), tuple("repoName-2", "project-2", projectDto2.getKey(), projectDto2.getName()));
}
Also used : ProjectDto(org.sonar.db.project.ProjectDto) SearchAzureReposWsResponse(org.sonarqube.ws.AlmIntegrations.SearchAzureReposWsResponse) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) Test(org.junit.Test)

Example 13 with SearchAzureReposWsResponse

use of org.sonarqube.ws.AlmIntegrations.SearchAzureReposWsResponse in project sonarqube by SonarSource.

the class SearchAzureReposActionTest method search_repos_with_project_name_and_empty_criteria.

@Test
public void search_repos_with_project_name_and_empty_criteria() {
    AlmSettingDto almSetting = insertAlmSetting();
    SearchAzureReposWsResponse response = ws.newRequest().setParam("almSetting", almSetting.getKey()).setParam("projectName", "project-1").setParam("searchQuery", "").executeProtobuf(SearchAzureReposWsResponse.class);
    assertThat(response.getRepositoriesList()).extracting(AzureRepo::getName, AzureRepo::getProjectName).containsExactlyInAnyOrder(tuple("repoName-1", "project-1"), tuple("repoName-2", "project-2"));
}
Also used : SearchAzureReposWsResponse(org.sonarqube.ws.AlmIntegrations.SearchAzureReposWsResponse) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) Test(org.junit.Test)

Aggregations

SearchAzureReposWsResponse (org.sonarqube.ws.AlmIntegrations.SearchAzureReposWsResponse)13 AlmSettingDto (org.sonar.db.alm.setting.AlmSettingDto)12 Test (org.junit.Test)11 GsonAzureRepoList (org.sonar.alm.client.azure.GsonAzureRepoList)6 ProjectDto (org.sonar.db.project.ProjectDto)5 Comparator.comparing (java.util.Comparator.comparing)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Optional (java.util.Optional)1 Set (java.util.Set)1 BinaryOperator (java.util.function.BinaryOperator)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 Collectors.toList (java.util.stream.Collectors.toList)1 Collectors.toMap (java.util.stream.Collectors.toMap)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 Nullable (javax.annotation.Nullable)1 StringUtils.containsIgnoreCase (org.apache.commons.lang.StringUtils.containsIgnoreCase)1