use of org.sonar.scanner.repository.ProjectRepositories in project sonarqube by SonarSource.
the class ProjectRepositoriesProviderTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
Table<String, String, String> t1 = HashBasedTable.create();
Table<String, String, FileData> t2 = HashBasedTable.create();
project = new ProjectRepositories(t1, t2, new Date());
provider = new ProjectRepositoriesProvider();
when(projectKey.get()).thenReturn("key");
}
use of org.sonar.scanner.repository.ProjectRepositories in project sonarqube by SonarSource.
the class ProjectRepositoriesProviderTest method testAssociated.
@Test
public void testAssociated() {
when(mode.isIssues()).thenReturn(false);
when(loader.load(eq("key"), eq(false))).thenReturn(project);
ProjectRepositories repo = provider.provide(loader, projectKey, mode);
assertThat(repo.exists()).isEqualTo(true);
assertThat(repo.lastAnalysisDate()).isNotNull();
verify(mode, times(2)).isIssues();
verify(projectKey).get();
verify(loader).load(eq("key"), eq(false));
verifyNoMoreInteractions(loader, projectKey, mode);
}
use of org.sonar.scanner.repository.ProjectRepositories in project sonarqube by SonarSource.
the class ModuleSettingsTest method test_loading_of_parent_module_settings_for_new_module.
// SONAR-6386
@Test
public void test_loading_of_parent_module_settings_for_new_module() {
GlobalSettings globalSettings = newGlobalSettings(ImmutableMap.of("overridding", "batch", "on-batch", "true"));
ProjectRepositories projRepos = createSettings("struts", ImmutableMap.of("on-module", "true", "overridding", "module"));
ProjectDefinition module = ProjectDefinition.create().setKey("struts-core");
ProjectDefinition.create().setKey("struts").addSubProject(module);
ModuleSettings moduleSettings = new ModuleSettings(globalSettings, module, projRepos, mode, mock(AnalysisContextReportPublisher.class));
assertThat(moduleSettings.getString("overridding")).isEqualTo("module");
assertThat(moduleSettings.getString("on-batch")).isEqualTo("true");
assertThat(moduleSettings.getString("on-module")).isEqualTo("true");
}
use of org.sonar.scanner.repository.ProjectRepositories in project sonarqube by SonarSource.
the class ProjectSettingsTest method should_not_fail_when_accessing_secured_properties.
@Test
public void should_not_fail_when_accessing_secured_properties() {
Table<String, String, String> settings = HashBasedTable.create();
settings.put("struts", "sonar.foo.secured", "bar");
settings.put("struts", "sonar.foo.license.secured", "bar2");
projectRef = new ProjectRepositories(settings, emptyFileData, null);
ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
assertThat(batchSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
assertThat(batchSettings.getString("sonar.foo.secured")).isEqualTo("bar");
}
use of org.sonar.scanner.repository.ProjectRepositories in project sonarqube by SonarSource.
the class ProjectSettingsTest method should_load_project_root_settings_on_branch.
@Test
public void should_load_project_root_settings_on_branch() {
project.setProperty(CoreProperties.PROJECT_BRANCH_PROPERTY, "mybranch");
Table<String, String, String> settings = HashBasedTable.create();
settings.put("struts:mybranch", "sonar.cpd.cross", "true");
settings.put("struts:mybranch", "sonar.java.coveragePlugin", "jacoco");
projectRef = new ProjectRepositories(settings, emptyFileData, null);
ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
assertThat(batchSettings.getString("sonar.java.coveragePlugin")).isEqualTo("jacoco");
}
Aggregations