コード例 #1
0
        public void ProcArgs_TryGetSetting()
        {
            // 0. Setup
            ListPropertiesProvider cmdLineProps = new ListPropertiesProvider();

            cmdLineProps.AddProperty("cmd.key.1", "cmd value 1");
            cmdLineProps.AddProperty("shared.key.1", "shared cmd value");

            ListPropertiesProvider fileProps = new ListPropertiesProvider();

            fileProps.AddProperty("file.key.1", "file value 1");
            fileProps.AddProperty("shared.key.1", "shared file value");

            ProcessedArgs args = new ProcessedArgs("key", "name", "ver", false, cmdLineProps, fileProps);

            // 1. Missing key -> null
            string result;

            Assert.IsFalse(args.TryGetSetting("missing.property", out result), "Expecting false when the specified key does not exist");
            Assert.IsNull(result, "Expecting the value to be null when the specified key does not exist");

            // 2. Returns existing values
            Assert.IsTrue(args.TryGetSetting("cmd.key.1", out result));
            Assert.AreEqual("cmd value 1", result);

            // 3. Precedence - command line properties should win
            Assert.AreEqual("shared cmd value", args.GetSetting("shared.key.1"));

            // 4. Preprocessor only settings
            Assert.AreEqual(false, args.InstallLoaderTargets);
        }
コード例 #2
0
        public void ProcArgs_GetSetting()
        {
            // 0. Setup
            ListPropertiesProvider cmdLineProps = new ListPropertiesProvider();

            cmdLineProps.AddProperty("cmd.key.1", "cmd value 1");
            cmdLineProps.AddProperty("shared.key.1", "shared cmd value");

            ListPropertiesProvider fileProps = new ListPropertiesProvider();

            fileProps.AddProperty("file.key.1", "file value 1");
            fileProps.AddProperty("shared.key.1", "shared file value");

            ProcessedArgs args = new ProcessedArgs("key", "name", "ver", true, cmdLineProps, fileProps);

            // 1. Throws on missing value
            AssertException.Expects <InvalidOperationException>(() => args.GetSetting("missing.property"));

            // 2. Returns existing values
            Assert.AreEqual("cmd value 1", args.GetSetting("cmd.key.1"));
            Assert.AreEqual("file value 1", args.GetSetting("file.key.1"));

            // 3. Precedence - command line properties should win
            Assert.AreEqual("shared cmd value", args.GetSetting("shared.key.1"));

            // 4. Preprocessor only settings
            Assert.AreEqual(true, args.InstallLoaderTargets);
        }
コード例 #3
0
        public void ProcArgs_CmdLinePropertiesOverrideFileSettings()
        {
            // Checks command line properties override those from files

            // Arrange
            // The set of command line properties to supply
            ListPropertiesProvider cmdLineProperties = new ListPropertiesProvider();

            cmdLineProperties.AddProperty("shared.key1", "cmd line value1 - should override server value");
            cmdLineProperties.AddProperty("cmd.line.only", "cmd line value4 - only on command line");
            cmdLineProperties.AddProperty("xxx", "cmd line value XXX - lower case");
            cmdLineProperties.AddProperty(SonarProperties.HostUrl, "http://host");

            // The set of file properties to supply
            ListPropertiesProvider fileProperties = new ListPropertiesProvider();

            fileProperties.AddProperty("shared.key1", "file value1 - should be overridden");
            fileProperties.AddProperty("file.only", "file value3 - only in file");
            fileProperties.AddProperty("XXX", "file line value XXX - upper case");

            // Act
            ProcessedArgs args = new ProcessedArgs("key", "name", "version", false, cmdLineProperties, fileProperties);

            AssertExpectedValue("shared.key1", "cmd line value1 - should override server value", args);
            AssertExpectedValue("cmd.line.only", "cmd line value4 - only on command line", args);
            AssertExpectedValue("file.only", "file value3 - only in file", args);
            AssertExpectedValue("xxx", "cmd line value XXX - lower case", args);
            AssertExpectedValue("XXX", "file line value XXX - upper case", args);
            AssertExpectedValue(SonarProperties.HostUrl, "http://host", args);
        }
コード例 #4
0
        public void ProcArgs_GetSettingOrDefault()
        {
            // 0. Setup
            ListPropertiesProvider cmdLineProps = new ListPropertiesProvider();

            cmdLineProps.AddProperty("cmd.key.1", "cmd value 1");
            cmdLineProps.AddProperty("shared.key.1", "shared cmd value");

            ListPropertiesProvider fileProps = new ListPropertiesProvider();

            fileProps.AddProperty("file.key.1", "file value 1");
            fileProps.AddProperty("shared.key.1", "shared file value");

            ProcessedArgs args = new ProcessedArgs("key", "name", "ver", true, cmdLineProps, fileProps);

            // 1. Missing key -> default returned
            string result = args.GetSetting("missing.property", "default value");

            Assert.AreEqual("default value", result);

            // 2. Returns existing values
            result = args.GetSetting("file.key.1", "default value");
            Assert.AreEqual("file value 1", result);

            // 3. Precedence - command line properties should win
            Assert.AreEqual("shared cmd value", args.GetSetting("shared.key.1", "default ValueType"));

            // 4. Preprocessor only settings
            Assert.AreEqual(true, args.InstallLoaderTargets);
        }
コード例 #5
0
        public void AddProperty_WhenKeyAlreadyExist_ThrowsArgumentOutOfRangeException()
        {
            // Arrange
            var testSubject = new ListPropertiesProvider();
            testSubject.AddProperty("foo", "foo");

            Action action = () => testSubject.AddProperty("foo", "foo");

            // Act & Assert
            action.Should().ThrowExactly<ArgumentOutOfRangeException>().And.ParamName.Should().Be("key");
        }
コード例 #6
0
        private static ListPropertiesProvider CreatePropertiesProvider(string verbosity, string logLevel)
        {
            ListPropertiesProvider propertyProvider = new ListPropertiesProvider();
            if (verbosity != null)
            {
                propertyProvider.AddProperty(SonarProperties.Verbose, verbosity);
            }
            if (logLevel != null)
            {
                propertyProvider.AddProperty(SonarProperties.LogLevel, logLevel);
            }

            return propertyProvider;
        }
コード例 #7
0
        private static ListPropertiesProvider CreatePropertiesProvider(string verbosity, string logLevel)
        {
            ListPropertiesProvider propertyProvider = new ListPropertiesProvider();

            if (verbosity != null)
            {
                propertyProvider.AddProperty(SonarProperties.Verbose, verbosity);
            }
            if (logLevel != null)
            {
                propertyProvider.AddProperty(SonarProperties.LogLevel, logLevel);
            }

            return(propertyProvider);
        }
        public void AggProperties_Aggregation()
        {
            // Checks the aggregation works as expected

            // 0. Setup
            ListPropertiesProvider provider1 = new ListPropertiesProvider();

            provider1.AddProperty("shared.key.A", "value A from one");
            provider1.AddProperty("shared.key.B", "value B from one");
            provider1.AddProperty("p1.unique.key.1", "p1 unique value 1");

            ListPropertiesProvider provider2 = new ListPropertiesProvider();

            provider2.AddProperty("shared.key.A", "value A from two");
            provider2.AddProperty("shared.key.B", "value B from two");
            provider2.AddProperty("p2.unique.key.1", "p2 unique value 1");

            ListPropertiesProvider provider3 = new ListPropertiesProvider();

            provider3.AddProperty("shared.key.A", "value A from three"); // this provider only has one of the shared values
            provider3.AddProperty("p3.unique.key.1", "p3 unique value 1");


            // 1. Ordering
            AggregatePropertiesProvider aggProvider = new AggregatePropertiesProvider(provider1, provider2, provider3);

            aggProvider.AssertExpectedPropertyCount(5);

            aggProvider.AssertExpectedPropertyValue("shared.key.A", "value A from one");
            aggProvider.AssertExpectedPropertyValue("shared.key.B", "value B from one");

            aggProvider.AssertExpectedPropertyValue("p1.unique.key.1", "p1 unique value 1");
            aggProvider.AssertExpectedPropertyValue("p2.unique.key.1", "p2 unique value 1");
            aggProvider.AssertExpectedPropertyValue("p3.unique.key.1", "p3 unique value 1");

            // 2. Reverse the order and try again
            aggProvider = new AggregatePropertiesProvider(provider3, provider2, provider1);

            aggProvider.AssertExpectedPropertyCount(5);

            aggProvider.AssertExpectedPropertyValue("shared.key.A", "value A from three");
            aggProvider.AssertExpectedPropertyValue("shared.key.B", "value B from two");

            aggProvider.AssertExpectedPropertyValue("p1.unique.key.1", "p1 unique value 1");
            aggProvider.AssertExpectedPropertyValue("p2.unique.key.1", "p2 unique value 1");
            aggProvider.AssertExpectedPropertyValue("p3.unique.key.1", "p3 unique value 1");
        }
        public void AnalysisConfGen_Simple()
        {
            // Arrange
            string analysisDir = TestUtils.CreateTestSpecificFolder(this.TestContext);

            TestLogger logger = new TestLogger();

            ListPropertiesProvider propertyProvider = new ListPropertiesProvider();

            propertyProvider.AddProperty(SonarProperties.HostUrl, "http://foo");
            ProcessedArgs args = new ProcessedArgs("valid.key", "valid.name", "1.0", false, EmptyPropertyProvider.Instance, propertyProvider);

            TeamBuildSettings tbSettings = TeamBuildSettings.CreateNonTeamBuildSettingsForTesting(analysisDir);

            Dictionary <string, string> serverSettings = new Dictionary <string, string>();

            serverSettings.Add("server.key.1", "server.value.1");

            AnalyzerSettings analyzerSettings = new AnalyzerSettings();

            analyzerSettings.RuleSetFilePath     = "c:\\xxx.ruleset";
            analyzerSettings.AdditionalFilePaths = new List <string>();
            analyzerSettings.AdditionalFilePaths.Add("f:\\additionalPath1.txt");
            analyzerSettings.AnalyzerAssemblyPaths = new List <string>();
            analyzerSettings.AnalyzerAssemblyPaths.Add("f:\\temp\\analyzer1.dll");

            List <AnalyzerSettings> analyzersSettings = new List <AnalyzerSettings>();

            analyzersSettings.Add(analyzerSettings);
            Directory.CreateDirectory(tbSettings.SonarConfigDirectory); // config directory needs to exist

            // Act
            AnalysisConfig actualConfig = AnalysisConfigGenerator.GenerateFile(args, tbSettings, serverSettings, analyzersSettings, logger);

            // Assert
            AssertConfigFileExists(actualConfig);
            logger.AssertErrorsLogged(0);
            logger.AssertWarningsLogged(0);

            Assert.AreEqual("valid.key", actualConfig.SonarProjectKey);
            Assert.AreEqual("valid.name", actualConfig.SonarProjectName);
            Assert.AreEqual("1.0", actualConfig.SonarProjectVersion);

            Assert.AreEqual("http://foo", actualConfig.SonarQubeHostUrl);

            Assert.AreEqual(tbSettings.SonarBinDirectory, actualConfig.SonarBinDir);
            Assert.AreEqual(tbSettings.SonarConfigDirectory, actualConfig.SonarConfigDir);
            Assert.AreEqual(tbSettings.SonarOutputDirectory, actualConfig.SonarOutputDir);
            Assert.AreEqual(tbSettings.SonarScannerWorkingDirectory, actualConfig.SonarScannerWorkingDirectory);
            Assert.AreEqual(tbSettings.BuildUri, actualConfig.GetBuildUri());
            Assert.AreEqual(tbSettings.TfsUri, actualConfig.GetTfsUri());

            Assert.IsNotNull(actualConfig.ServerSettings);
            Property serverProperty = actualConfig.ServerSettings.SingleOrDefault(s => string.Equals(s.Id, "server.key.1", System.StringComparison.Ordinal));

            Assert.IsNotNull(serverProperty);
            Assert.AreEqual("server.value.1", serverProperty.Value);
            Assert.AreSame(analyzerSettings, actualConfig.AnalyzersSettings[0]);
        }
        public void AggProperties_Aggregation()
        {
            // Checks the aggregation works as expected

            // 0. Setup
            ListPropertiesProvider provider1 = new ListPropertiesProvider();
            provider1.AddProperty("shared.key.A", "value A from one");
            provider1.AddProperty("shared.key.B", "value B from one");
            provider1.AddProperty("p1.unique.key.1", "p1 unique value 1");

            ListPropertiesProvider provider2 = new ListPropertiesProvider();
            provider2.AddProperty("shared.key.A", "value A from two");
            provider2.AddProperty("shared.key.B", "value B from two");
            provider2.AddProperty("p2.unique.key.1", "p2 unique value 1");

            ListPropertiesProvider provider3 = new ListPropertiesProvider();
            provider3.AddProperty("shared.key.A", "value A from three"); // this provider only has one of the shared values
            provider3.AddProperty("p3.unique.key.1", "p3 unique value 1");


            // 1. Ordering
            AggregatePropertiesProvider aggProvider = new AggregatePropertiesProvider(provider1, provider2, provider3);

            aggProvider.AssertExpectedPropertyCount(5);

            aggProvider.AssertExpectedPropertyValue("shared.key.A", "value A from one");
            aggProvider.AssertExpectedPropertyValue("shared.key.B", "value B from one");

            aggProvider.AssertExpectedPropertyValue("p1.unique.key.1", "p1 unique value 1");
            aggProvider.AssertExpectedPropertyValue("p2.unique.key.1", "p2 unique value 1");
            aggProvider.AssertExpectedPropertyValue("p3.unique.key.1", "p3 unique value 1");

            // 2. Reverse the order and try again
            aggProvider = new AggregatePropertiesProvider(provider3, provider2, provider1);

            aggProvider.AssertExpectedPropertyCount(5);

            aggProvider.AssertExpectedPropertyValue("shared.key.A", "value A from three");
            aggProvider.AssertExpectedPropertyValue("shared.key.B", "value B from two");

            aggProvider.AssertExpectedPropertyValue("p1.unique.key.1", "p1 unique value 1");
            aggProvider.AssertExpectedPropertyValue("p2.unique.key.1", "p2 unique value 1");
            aggProvider.AssertExpectedPropertyValue("p3.unique.key.1", "p3 unique value 1");
        }
        public void HasProperty_PropertyDoesNotExist_ReturnsFalse()
        {
            // Arrange
            var properties = new ListPropertiesProvider();

            properties.AddProperty("prop1", "value1");

            // Act & Assert - comparison should be case-sensitive
            AnalysisPropertyProviderExtensions.HasProperty(properties, "PROP1").Should().BeFalse();
        }
        public void HasProperty_PropertyExists_ReturnsTrue()
        {
            // Arrange
            var properties = new ListPropertiesProvider();

            properties.AddProperty("prop1", "value1");

            // Act & Assert
            AnalysisPropertyProviderExtensions.HasProperty(properties, "prop1").Should().BeTrue();
        }
コード例 #13
0
        public void TestInitialize()
        {
            // 0. Setup
            var cmdLineProps = new ListPropertiesProvider();

            cmdLineProps.AddProperty("cmd.key.1", "cmd value 1");
            cmdLineProps.AddProperty("shared.key.1", "shared cmd value");

            var fileProps = new ListPropertiesProvider();

            fileProps.AddProperty("file.key.1", "file value 1");
            fileProps.AddProperty("shared.key.1", "shared file value");
            fileProps.AddProperty("shared.key.2", "shared file value");

            var envProps = new ListPropertiesProvider();

            envProps.AddProperty("env.key.1", "env value 1");
            envProps.AddProperty("shared.key.1", "shared env value");
            envProps.AddProperty("shared.key.2", "shared env value");

            args = new ProcessedArgs("key", "branch", "ver", null, true, cmdLineProps, fileProps, envProps);
        }
        public void TryGetValue_PropertyDoesNotExist_ReturnsFalseAndNull()
        {
            // Arrange
            var properties = new ListPropertiesProvider();

            properties.AddProperty("prop1", "value1");

            // Act - should be case-sensitive
            var exists = AnalysisPropertyProviderExtensions.TryGetValue(properties, "PROP1", out var actual);

            // Assert
            exists.Should().BeFalse();
            actual.Should().BeNull();
        }
        public void TryGetValue_PropertyExists_ReturnsTrueAndValue()
        {
            // Arrange
            var properties = new ListPropertiesProvider();

            properties.AddProperty("prop1", "value1");

            // Act
            var exists = AnalysisPropertyProviderExtensions.TryGetValue(properties, "prop1", out var actual);

            // Assert
            exists.Should().BeTrue();
            actual.Should().Be("value1");
        }
コード例 #16
0
        public void AnalysisConfGen_WhenLoginSpecified_StoresThatItWasSpecified()
        {
            // Arrange
            var analysisDir = TestUtils.CreateTestSpecificFolderWithSubPaths(TestContext);

            var logger = new TestLogger();

            var settings = TeamBuildSettings.CreateNonTeamBuildSettingsForTesting(analysisDir);

            Directory.CreateDirectory(settings.SonarConfigDirectory); // config directory needs to exist

            var cmdLineArgs = new ListPropertiesProvider();

            cmdLineArgs.AddProperty(SonarProperties.SonarUserName, "foo");
            var args = new ProcessedArgs("valid.key", "valid.name", "1.0", null, false, cmdLineArgs, EmptyPropertyProvider.Instance, EmptyPropertyProvider.Instance, logger);

            // Act
            var config = AnalysisConfigGenerator.GenerateFile(args, settings, new Dictionary <string, string>(), new List <AnalyzerSettings>(), new MockSonarQubeServer(), logger);

            // Assert
            AssertConfigFileExists(config);
            config.HasBeginStepCommandLineCredentials.Should().BeTrue();
        }
コード例 #17
0
        [WorkItem(127)] // Do not store the db and server credentials in the config files: http://jira.sonarsource.com/browse/SONARMSBRU-127
        public void AnalysisConfGen_AnalysisConfigDoesNotContainSensitiveData()
        {
            // Arrange
            var analysisDir = TestUtils.CreateTestSpecificFolderWithSubPaths(TestContext);

            var logger = new TestLogger();

            var cmdLineArgs = new ListPropertiesProvider();

            // Public args - should be written to the config file
            cmdLineArgs.AddProperty("sonar.host.url", "http://host");
            cmdLineArgs.AddProperty("public.key", "public value");
            cmdLineArgs.AddProperty("sonar.user.license.secured", "user input license");
            cmdLineArgs.AddProperty("server.key.secured.xxx", "not really secure");
            cmdLineArgs.AddProperty("sonar.value", "value.secured");

            // Sensitive values - should not be written to the config file
            cmdLineArgs.AddProperty(SonarProperties.DbPassword, "secret db password");

            // Create a settings file with public and sensitive data
            var fileSettings = new AnalysisProperties
            {
                new Property()
                {
                    Id = "file.public.key", Value = "file public value"
                },
                new Property()
                {
                    Id = SonarProperties.DbUserName, Value = "secret db user"
                },
                new Property()
                {
                    Id = SonarProperties.DbPassword, Value = "secret db password"
                }
            };
            var fileSettingsPath = Path.Combine(analysisDir, "fileSettings.txt");

            fileSettings.Save(fileSettingsPath);
            var fileProvider = FilePropertyProvider.Load(fileSettingsPath);

            var args = new ProcessedArgs("key", "name", "1.0", null, false, cmdLineArgs, fileProvider, EmptyPropertyProvider.Instance, logger);

            IDictionary <string, string> serverProperties = new Dictionary <string, string>
            {
                // Public server settings
                { "server.key.1", "server value 1" },
                // Sensitive server settings
                { SonarProperties.SonarUserName, "secret user" },
                { SonarProperties.SonarPassword, "secret pwd" },
                { "sonar.vbnet.license.secured", "secret license" },
                { "sonar.cpp.License.Secured", "secret license 2" }
            };

            var settings = TeamBuildSettings.CreateNonTeamBuildSettingsForTesting(analysisDir);

            Directory.CreateDirectory(settings.SonarConfigDirectory); // config directory needs to exist

            // Act
            var config = AnalysisConfigGenerator.GenerateFile(args, settings, serverProperties, new List <AnalyzerSettings>(), new MockSonarQubeServer(), logger);

            // Assert
            AssertConfigFileExists(config);
            logger.AssertErrorsLogged(0);
            logger.AssertWarningsLogged(0);

            // Check the config

            // "Public" arguments should be in the file
            config.SonarProjectKey.Should().Be("key", "Unexpected project key");
            config.SonarProjectName.Should().Be("name", "Unexpected project name");
            config.SonarProjectVersion.Should().Be("1.0", "Unexpected project version");

            AssertExpectedLocalSetting(SonarProperties.HostUrl, "http://host", config);
            AssertExpectedLocalSetting("sonar.user.license.secured", "user input license", config); // we only filter out *.secured server settings
            AssertExpectedLocalSetting("sonar.value", "value.secured", config);
            AssertExpectedLocalSetting("server.key.secured.xxx", "not really secure", config);
            AssertExpectedServerSetting("server.key.1", "server value 1", config);

            AssertFileDoesNotContainText(config.FileName, "file.public.key"); // file settings values should not be in the config
            AssertFileDoesNotContainText(config.FileName, "secret");          // sensitive data should not be in config
        }
コード例 #18
0
        public void AnalysisConfGen_Simple()
        {
            // Arrange
            var analysisDir = TestUtils.CreateTestSpecificFolderWithSubPaths(TestContext);

            var logger = new TestLogger();

            var propertyProvider = new ListPropertiesProvider();

            propertyProvider.AddProperty(SonarProperties.HostUrl, "http://foo");
            var args = new ProcessedArgs("valid.key", "valid.name", "1.0", null, false, EmptyPropertyProvider.Instance, propertyProvider, EmptyPropertyProvider.Instance, logger);

            var tbSettings = TeamBuildSettings.CreateNonTeamBuildSettingsForTesting(analysisDir);

            var serverSettings = new Dictionary <string, string>
            {
                { "server.key.1", "server.value.1" }
            };

            var analyzerSettings = new AnalyzerSettings
            {
                RuleSetFilePath     = "c:\\xxx.ruleset",
                AdditionalFilePaths = new List <string>()
            };

            analyzerSettings.AdditionalFilePaths.Add("f:\\additionalPath1.txt");
            analyzerSettings.AnalyzerPlugins = new List <AnalyzerPlugin>
            {
                new AnalyzerPlugin
                {
                    AssemblyPaths = new List <string> {
                        "f:\\temp\\analyzer1.dll"
                    }
                }
            };

            var analyzersSettings = new List <AnalyzerSettings>
            {
                analyzerSettings
            };

            Directory.CreateDirectory(tbSettings.SonarConfigDirectory); // config directory needs to exist

            // Act
            var actualConfig = AnalysisConfigGenerator.GenerateFile(args, tbSettings, serverSettings, analyzersSettings, new MockSonarQubeServer(), logger);

            // Assert
            AssertConfigFileExists(actualConfig);
            logger.AssertErrorsLogged(0);
            logger.AssertWarningsLogged(0);

            actualConfig.SonarProjectKey.Should().Be("valid.key");
            actualConfig.SonarProjectName.Should().Be("valid.name");
            actualConfig.SonarProjectVersion.Should().Be("1.0");

            actualConfig.SonarQubeHostUrl.Should().Be("http://foo");

            actualConfig.SonarBinDir.Should().Be(tbSettings.SonarBinDirectory);
            actualConfig.SonarConfigDir.Should().Be(tbSettings.SonarConfigDirectory);
            actualConfig.SonarOutputDir.Should().Be(tbSettings.SonarOutputDirectory);
            actualConfig.SonarScannerWorkingDirectory.Should().Be(tbSettings.SonarScannerWorkingDirectory);
            actualConfig.GetBuildUri().Should().Be(tbSettings.BuildUri);
            actualConfig.GetTfsUri().Should().Be(tbSettings.TfsUri);

            actualConfig.ServerSettings.Should().NotBeNull();
            var serverProperty = actualConfig.ServerSettings.SingleOrDefault(s => string.Equals(s.Id, "server.key.1", System.StringComparison.Ordinal));

            serverProperty.Should().NotBeNull();
            serverProperty.Value.Should().Be("server.value.1");
            actualConfig.AnalyzersSettings[0].Should().Be(analyzerSettings);
        }
コード例 #19
0
        [WorkItem(127)] // Do not store the db and server credentials in the config files: http://jira.sonarsource.com/browse/SONARMSBRU-127
        public void AnalysisConfGen_AnalysisConfigDoesNotContainSensitiveData()
        {
            // Arrange
            string analysisDir = TestUtils.CreateTestSpecificFolder(this.TestContext);

            TestLogger logger = new TestLogger();

            ListPropertiesProvider cmdLineArgs = new ListPropertiesProvider();

            // Public args - should be written to the config file
            cmdLineArgs.AddProperty("sonar.host.url", "http://host");
            cmdLineArgs.AddProperty("public.key", "public value");

            // Sensitive values - should not be written to the config file
            cmdLineArgs.AddProperty(SonarProperties.DbPassword, "secret db password");
            cmdLineArgs.AddProperty(SonarProperties.DbUserName, "secret db user");

            // Create a settings file with public and sensitive data
            AnalysisProperties fileSettings = new AnalysisProperties();

            fileSettings.Add(new Property()
            {
                Id = "file.public.key", Value = "file public value"
            });
            fileSettings.Add(new Property()
            {
                Id = SonarProperties.DbUserName, Value = "secret db user"
            });
            fileSettings.Add(new Property()
            {
                Id = SonarProperties.DbPassword, Value = "secret db password"
            });
            string fileSettingsPath = Path.Combine(analysisDir, "fileSettings.txt");

            fileSettings.Save(fileSettingsPath);
            FilePropertyProvider fileProvider = FilePropertyProvider.Load(fileSettingsPath);

            ProcessedArgs args = new ProcessedArgs("key", "name", "1.0", false, cmdLineArgs, fileProvider);

            IDictionary <string, string> serverProperties = new Dictionary <string, string>();

            // Public server settings
            serverProperties.Add("server.key.1", "server value 1");
            // Sensitive server settings
            serverProperties.Add(SonarProperties.SonarUserName, "secret user");
            serverProperties.Add(SonarProperties.SonarPassword, "secret pwd");

            TeamBuildSettings settings = TeamBuildSettings.CreateNonTeamBuildSettingsForTesting(analysisDir);

            Directory.CreateDirectory(settings.SonarConfigDirectory); // config directory needs to exist

            // Act
            AnalysisConfig config = AnalysisConfigGenerator.GenerateFile(args, settings, serverProperties, logger);

            // Assert
            AssertConfigFileExists(config);
            logger.AssertErrorsLogged(0);
            logger.AssertWarningsLogged(0);

            // Check the config

            // "Public" arguments should be in the file
            Assert.AreEqual("key", config.SonarProjectKey, "Unexpected project key");
            Assert.AreEqual("name", config.SonarProjectName, "Unexpected project name");
            Assert.AreEqual("1.0", config.SonarProjectVersion, "Unexpected project version");

            AssertExpectedLocalSetting(SonarProperties.HostUrl, "http://host", config);
            AssertExpectedServerSetting("server.key.1", "server value 1", config);

            AssertFileDoesNotContainText(config.FileName, "file.public.key"); // file settings values should not be in the config

            // SONARMSBRU-136: TODO - uncomment the following code:
            AssertFileDoesNotContainText(config.FileName, "secret"); // sensitive data should not be in config
        }