use of org.sonarqube.ws.client.component.SearchWsRequest in project sonarqube by SonarSource.
the class ScannerTest method should_scan_branch_with_forward_slash.
/**
* SONAR-3718
*/
@Test
public void should_scan_branch_with_forward_slash() {
scan("shared/xoo-multi-modules-sample");
scan("shared/xoo-multi-modules-sample", "sonar.branch", "branch/0.x");
assertThat(newAdminWsClient(orchestrator).components().search(new SearchWsRequest().setQualifiers(singletonList("TRK"))).getComponentsList()).hasSize(2);
assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:multi-modules-sample").getName()).isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample");
assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:multi-modules-sample:branch/0.x").getName()).isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample branch/0.x");
}
use of org.sonarqube.ws.client.component.SearchWsRequest in project sonarqube by SonarSource.
the class SearchActionTest method search_with_language.
@Test
public void search_with_language() throws IOException {
OrganizationDto organizationDto = db.organizations().insert();
insertProjectsAuthorizedForUser(newProjectDto(organizationDto).setKey("java-project").setLanguage("java"), newProjectDto(organizationDto).setKey("cpp-project").setLanguage("cpp"));
SearchWsResponse response = call(new SearchWsRequest().setOrganization(organizationDto.getKey()).setLanguage("java").setQualifiers(singletonList(PROJECT)));
assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly("java-project");
}
use of org.sonarqube.ws.client.component.SearchWsRequest in project sonarqube by SonarSource.
the class SearchActionTest method search_for_files.
@Test
public void search_for_files() throws IOException {
ComponentDto project = newProjectDto(db.getDefaultOrganization());
ComponentDto file1 = newFileDto(project).setKey("file1");
ComponentDto file2 = newFileDto(project).setKey("file2");
db.components().insertComponents(project, file1, file2);
setBrowsePermissionOnUser(project);
SearchWsResponse response = call(new SearchWsRequest().setQuery(file1.key()).setQualifiers(singletonList(FILE)));
assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(file1.getKey());
}
use of org.sonarqube.ws.client.component.SearchWsRequest in project sonarqube by SonarSource.
the class SearchActionTest method fail_when_no_qualifier_provided.
@Test
public void fail_when_no_qualifier_provided() {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("The 'qualifiers' parameter is missing");
call(new SearchWsRequest());
}
use of org.sonarqube.ws.client.component.SearchWsRequest in project sonarqube by SonarSource.
the class SearchActionTest method do_not_verify_permissions_if_user_is_root.
@Test
public void do_not_verify_permissions_if_user_is_root() throws IOException {
OrganizationDto org = db.organizations().insert();
ComponentDto project1 = newProjectDto(org);
ComponentDto file1 = newFileDto(project1);
ComponentDto project2 = newProjectDto(org);
ComponentDto file2 = newFileDto(project2);
db.components().insertComponents(project1, file1, project2, file2);
SearchWsRequest request = new SearchWsRequest().setQualifiers(singletonList(FILE)).setOrganization(org.getKey());
userSession.logIn().setNonRoot();
assertThat(call(request).getComponentsCount()).isZero();
userSession.logIn().setRoot();
assertThat(call(request).getComponentsList()).extracting(Component::getKey).containsOnly(file1.getKey(), file2.getKey());
}
Aggregations