Search in sources :

Example 11 with TreeWsResponse

use of org.sonarqube.ws.WsComponents.TreeWsResponse in project sonarqube by SonarSource.

the class TreeActionTest method sort_descendants_by_qualifier.

@Test
public void sort_descendants_by_qualifier() throws IOException {
    ComponentDto project = newProjectDto(db.organizations().insert(), "project-uuid");
    componentDb.insertProjectAndSnapshot(project);
    componentDb.insertComponent(newFileDto(project, 1));
    componentDb.insertComponent(newFileDto(project, 2));
    ComponentDto module = newModuleDto("module-uuid-1", project);
    componentDb.insertComponent(module);
    componentDb.insertComponent(newDirectory(project, "path/directory/", "directory-uuid-1"));
    db.commit();
    logInWithBrowsePermission(project);
    TreeWsResponse response = call(ws.newRequest().setParam(PARAM_STRATEGY, "all").setParam(Param.SORT, "qualifier, name").setParam(PARAM_COMPONENT_ID, "project-uuid"));
    assertThat(response.getComponentsList()).extracting("id").containsExactly("module-uuid-1", "path/directory/", "file-uuid-1", "file-uuid-2");
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto) TreeWsResponse(org.sonarqube.ws.WsComponents.TreeWsResponse) Test(org.junit.Test)

Aggregations

TreeWsResponse (org.sonarqube.ws.WsComponents.TreeWsResponse)11 ComponentDto (org.sonar.db.component.ComponentDto)10 Test (org.junit.Test)9 SnapshotDto (org.sonar.db.component.SnapshotDto)1 OrganizationDto (org.sonar.db.organization.OrganizationDto)1