* Returns all projects (Scope {@link org.sonar.api.resources.Scopes#PROJECT} and qualifier
* {@link org.sonar.api.resources.Qualifiers#PROJECT}) which are enabled.
*
+ * Branches are not returned.
+ *
* Used by Views.
*/
public List<ComponentDto> selectProjects(DbSession session) {
public void select_projects() {
OrganizationDto organization = db.organizations().insert();
ComponentDto provisionedProject = db.components().insertPrivateProject();
- ComponentDto provisionedView = db.components().insertView(organization, (dto) -> {
- });
+ ComponentDto provisionedView = db.components().insertView(organization);
String projectUuid = db.components().insertProjectAndSnapshot(newPrivateProjectDto(organization)).getComponentUuid();
String disabledProjectUuid = db.components().insertProjectAndSnapshot(newPrivateProjectDto(organization).setEnabled(false)).getComponentUuid();
String viewUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newView(organization)).getComponentUuid();
.containsOnly(provisionedProject.uuid(), projectUuid);
}
+ @Test
+ public void select_projects_does_not_return_branches() {
+ OrganizationDto organization = db.organizations().insert();
+ ComponentDto project = db.components().insertMainBranch();
+ ComponentDto branch = db.components().insertProjectBranch(project);
+
+ assertThat(underTest.selectProjects(dbSession))
+ .extracting(ComponentDto::uuid)
+ .containsOnly(project.uuid());
+ }
+
@Test
public void select_provisioned() {
OrganizationDto organization = db.organizations().insert();