コード例 #1
0
        public void BootSettings_DownloadConfigOverridesEnvVars()
        {
            // 0. Setup
            TestLogger logger = new TestLogger();

            using (EnvironmentVariableScope envScope = new EnvironmentVariableScope())
            {
                AppConfigWrapper configScope = new AppConfigWrapper();

                envScope.SetVariable(BootstrapperSettings.SQAnalysisRootPath, "env download dir");
                configScope.SetDownloadDir("config download dir");

                // 1. Check the config scope takes precedence
                IBootstrapperSettings settings = new BootstrapperSettings(logger, configScope.AppConfig);
                AssertExpectedDownloadDir(@"config download dir", settings);

                // 2. Now clear the config scope and check the env var is used
                configScope.Reset();
                settings = new BootstrapperSettings(logger);
                AssertExpectedDownloadDir(@"env download dir\sqtemp\bin", settings);
            }
        }
コード例 #2
0
        public void BootSettings_PreProcessorPath()
        {
            // 0. Setup
            TestLogger       logger      = new TestLogger();
            AppConfigWrapper configScope = new AppConfigWrapper();

            configScope.SetDownloadDir(@"c:\temp");

            // 1. Default value -> relative to download dir
            IBootstrapperSettings settings = new BootstrapperSettings(logger, configScope.AppConfig);

            AssertExpectedPreProcessPath(@"c:\temp\SonarQube.MSBuild.PreProcessor.exe", settings);

            // 2. Relative exe set in config -> relative to download dir
            configScope.SetPreProcessExe(@"..\myCustomPreProcessor.exe");
            settings = new BootstrapperSettings(logger, configScope.AppConfig);
            AssertExpectedPreProcessPath(@"c:\myCustomPreProcessor.exe", settings);

            // 3. Now set the config path to an absolute value
            configScope.SetPreProcessExe(@"d:\myCustomPreProcessor.exe");
            settings = new BootstrapperSettings(logger, configScope.AppConfig);
            AssertExpectedPreProcessPath(@"d:\myCustomPreProcessor.exe", settings);
        }