public GlobalConfiguration provide(GlobalServerSettings globalServerSettings, ScannerProperties scannerProps, PropertyDefinitions propertyDefinitions) { if (globalConfig == null) { Map<String, String> mergedSettings = new LinkedHashMap<>(); mergedSettings.putAll(globalServerSettings.properties()); mergedSettings.putAll(scannerProps.properties()); globalConfig = new GlobalConfiguration(propertyDefinitions, scannerProps.getEncryption(), mergedSettings); } return globalConfig; } }
public DefaultAnalysisMode(ScannerProperties props, GlobalAnalysisMode analysisMode) { this.analysisMode = analysisMode; this.analysisProps = props.properties(); load(); printFlags(); }
public ProjectReactor execute() { Profiler profiler = Profiler.create(LOG).startInfo("Process project properties"); Map<String, Map<String, String>> propertiesByModuleIdPath = new HashMap<>(); extractPropertiesByModule(propertiesByModuleIdPath, "", "", new HashMap<>(scannerProps.properties())); ProjectDefinition rootProject = createModuleDefinition(propertiesByModuleIdPath.get(""), null); rootProjectWorkDir = rootProject.getWorkDir(); defineChildren(rootProject, propertiesByModuleIdPath, ""); cleanAndCheckProjectDefinitions(rootProject); profiler.stopDebug(); return new ProjectReactor(rootProject); }
@Test public void test_copy_of_properties() { Map<String, String> map = Maps.newHashMap(); map.put("foo", "bar"); ScannerProperties underTest = new ScannerProperties(map); assertThat(underTest.properties()).containsOnly(entry("foo", "bar")); assertThat(underTest.properties()).isNotSameAs(map); map.put("put", "after_copy"); assertThat(underTest.properties()).hasSize(1); } }
@Test public void testProfileProp() { when(loader.load(eq("project"), eq("custom"))).thenReturn(response); when(props.property(QualityProfiles.SONAR_PROFILE_PROP)).thenReturn("custom"); when(props.properties()).thenReturn(ImmutableMap.of(QualityProfiles.SONAR_PROFILE_PROP, "custom")); QualityProfiles qps = qualityProfileProvider.provide(loader, projectRepo, props); assertResponse(qps); verify(loader).load(eq("project"), eq("custom")); verifyNoMoreInteractions(loader); assertThat(logTester.logs(LoggerLevel.WARN)).contains("Ability to set quality profile from command line using '" + QualityProfiles.SONAR_PROFILE_PROP + "' is deprecated and will be dropped in a future SonarQube version. Please configure quality profile used by your project on SonarQube server."); }
@Test public void testProfilePropDefault() { when(projectRepo.exists()).thenReturn(false); when(loader.loadDefault(eq("custom"))).thenReturn(response); when(props.property(QualityProfiles.SONAR_PROFILE_PROP)).thenReturn("custom"); when(props.properties()).thenReturn(ImmutableMap.of(QualityProfiles.SONAR_PROFILE_PROP, "custom")); QualityProfiles qps = qualityProfileProvider.provide(loader, projectRepo, props); assertResponse(qps); verify(loader).loadDefault(eq("custom")); verifyNoMoreInteractions(loader); assertThat(logTester.logs(LoggerLevel.WARN)).contains("Ability to set quality profile from command line using '" + QualityProfiles.SONAR_PROFILE_PROP + "' is deprecated and will be dropped in a future SonarQube version. Please configure quality profile used by your project on SonarQube server."); }
public GlobalConfiguration provide(GlobalServerSettings globalServerSettings, ScannerProperties scannerProps, PropertyDefinitions propertyDefinitions) { if (globalConfig == null) { Map<String, String> mergedSettings = new LinkedHashMap<>(); mergedSettings.putAll(globalServerSettings.properties()); mergedSettings.putAll(scannerProps.properties()); globalConfig = new GlobalConfiguration(propertyDefinitions, scannerProps.getEncryption(), mergedSettings); } return globalConfig; } }
public DefaultAnalysisMode(ScannerProperties props, GlobalAnalysisMode analysisMode) { this.analysisMode = analysisMode; this.analysisProps = props.properties(); load(); printFlags(); }
public ProjectReactor execute() { Profiler profiler = Profiler.create(LOG).startInfo("Process project properties"); Map<String, Map<String, String>> propertiesByModuleIdPath = new HashMap<>(); extractPropertiesByModule(propertiesByModuleIdPath, "", "", new HashMap<>(scannerProps.properties())); ProjectDefinition rootProject = createModuleDefinition(propertiesByModuleIdPath.get(""), null); rootProjectWorkDir = rootProject.getWorkDir(); defineChildren(rootProject, propertiesByModuleIdPath, ""); cleanAndCheckProjectDefinitions(rootProject); profiler.stopDebug(); return new ProjectReactor(rootProject); }