Search in sources :

Example 21 with ProjectRepositories

use of org.sonar.scanner.protocol.input.ProjectRepositories in project sonarqube by SonarSource.

the class ProjectDataLoaderMediumTest method not_returned_secured_settings_when_lgged_but_no_scan_permission.

@Test
public void not_returned_secured_settings_when_lgged_but_no_scan_permission() {
    OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
    dbClient.organizationDao().insert(dbSession, organizationDto);
    ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
    userSessionRule.logIn("john").addProjectUuidPermissions(UserRole.USER, project.uuid());
    dbClient.componentDao().insert(dbSession, project);
    addDefaultProfile();
    // Project properties
    dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR").setResourceId(project.getId()));
    dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey("sonar.jira.login.secured").setValue("john").setResourceId(project.getId()));
    dbSession.commit();
    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()).setIssuesMode(true));
    Map<String, String> projectSettings = ref.settings(project.key());
    assertThat(projectSettings).isEqualTo(ImmutableMap.of("sonar.jira.project.key", "SONAR"));
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto) OrganizationDto(org.sonar.db.organization.OrganizationDto) PropertyDto(org.sonar.db.property.PropertyDto) ProjectRepositories(org.sonar.scanner.protocol.input.ProjectRepositories) Test(org.junit.Test)

Aggregations

ProjectRepositories (org.sonar.scanner.protocol.input.ProjectRepositories)21 Test (org.junit.Test)19 ComponentDto (org.sonar.db.component.ComponentDto)18 OrganizationDto (org.sonar.db.organization.OrganizationDto)15 PropertyDto (org.sonar.db.property.PropertyDto)13 FileSourceDao (org.sonar.db.source.FileSourceDao)3 FileData (org.sonar.scanner.protocol.input.FileData)2 TestResponse (org.sonar.server.ws.TestResponse)2 WsProjectResponse (org.sonarqube.ws.WsBatch.WsProjectResponse)2 Date (java.util.Date)1 DbSession (org.sonar.db.DbSession)1 FilePathWithHashDto (org.sonar.db.component.FilePathWithHashDto)1