Beispiel #1
0
        public void BuildLegacyBuildSummaryLogger_Arguments_Check()
        {
            var factory = new LegacyTeamBuildFactory(new TestLogger());

            factory.BuildLegacyBuildSummaryLogger(tfsUri: "tfsUri", buildUri: "buildUri")
            .Should().BeOfType <LegacyBuildSummaryLogger>();

            factory.BuildTfsLegacyCoverageReportProcessor()
            .Should().BeOfType <TfsLegacyCoverageReportProcessor>();
        }
Beispiel #2
0
        public static int Execute(string[] args, ILogger logger)
        {
            try
            {
                /* Expected Arguments :
                 * Method : 0
                 * SonarQubeAnalysisConfig.xml path : 1
                 * sonar-project.properties : 2
                 * ranToCompletion : 3
                 */
                if (args.Length < 1)
                {
                    logger.LogError("No argument found. Exiting...");
                    return(1);
                }

                CommandLineArgs commandLineArgs = new CommandLineArgs(logger);
                if (!commandLineArgs.ParseArguments(args))
                {
                    return(1);
                }

                var            teamBuildSettings      = TeamBuildSettings.GetSettingsFromEnvironment(logger);
                AnalysisConfig config                 = AnalysisConfig.Load(commandLineArgs.SonarQubeAnalysisConfigPath);
                var            legacyTeamBuildFactory = new LegacyTeamBuildFactory(logger, config);

                switch (commandLineArgs.ProcessToExecute)
                {
                case Method.ConvertCoverage:
                    ExecuteCoverageConverter(logger, config, legacyTeamBuildFactory, teamBuildSettings, commandLineArgs.SonarProjectPropertiesPath);
                    break;

                case Method.SummaryReportBuilder:
                    ExecuteReportBuilder(logger, config, legacyTeamBuildFactory, teamBuildSettings, commandLineArgs.RanToCompletion, commandLineArgs.SonarProjectPropertiesPath);
                    break;
                }
            }
            catch (Exception ex)
            {
                logger.LogError("An exception occured while executing the process : " + ex.Message);
                logger.LogError(ex.StackTrace);
            }

            return(0);
        }