Ejemplo n.º 1
0
        public void ConfigureSonarCloud_CheckAllRequestsImplemented()
        {
            var testSubject = DefaultConfiguration.ConfigureSonarCloud(new UnversionedRequestFactory(new TestLogger()));
            var serverInfo  = new ServerInfo(null /* latest */, ServerType.SonarQube);

            testSubject.Create <IDownloadStaticFile>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetHotspotRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetIssuesRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetLanguagesRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetModulesRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetNotificationsRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetOrganizationsRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetPluginsRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetProjectsRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetPropertiesRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetQualityProfileChangeLogRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetQualityProfilesRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetRoslynExportProfileRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetRulesRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetTaintVulnerabilitiesRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetVersionRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IValidateCredentialsRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetSourceCodeRequest>(serverInfo).Should().NotBeNull();
            testSubject.Create <IGetProjectBranchesRequest>(serverInfo).Should().NotBeNull();
        }
Ejemplo n.º 2
0
        public void ConfigureSonarCloud_Writes_Debug_Messages()
        {
            var logger = new TestLogger();

            var expected = new string[]
            {
                "Registered SonarQube.Client.Api.V2_10.GetVersionRequest",
                "Registered SonarQube.Client.Api.V3_30.ValidateCredentialsRequest",
                "Registered SonarQube.Client.Api.V5_00.GetSourceCodeRequest",
                "Registered SonarQube.Client.Api.V5_10.GetLanguagesRequest",
                "Registered SonarQube.Client.Api.V5_40.GetModulesRequest",
                "Registered SonarQube.Client.Api.V5_50.GetRulesRequest",
                "Registered SonarQube.Client.Api.V5_50.DownloadStaticFile",
                "Registered SonarQube.Client.Api.V6_20.GetProjectsRequest",
                "Registered SonarQube.Client.Api.V6_30.GetPluginsRequest",
                "Registered SonarQube.Client.Api.V6_30.GetPropertiesRequest",
                "Registered SonarQube.Client.Api.V6_50.GetQualityProfileChangeLogRequest",
                "Registered SonarQube.Client.Api.V6_50.GetQualityProfilesRequest",
                "Registered SonarQube.Client.Api.V6_60.GetNotificationsRequest",
                "Registered SonarQube.Client.Api.V6_60.GetRoslynExportProfileRequest",
                "Registered SonarQube.Client.Api.V6_60.GetProjectBranchesRequest",
                "Registered SonarQube.Client.Api.V7_00.GetOrganizationsRequest",
                "Registered SonarQube.Client.Api.V7_20.GetIssuesRequestWrapper",
                "Registered SonarQube.Client.Api.V8_6.GetHotspotRequest",
                "Registered SonarQube.Client.Api.V8_6.GetTaintVulnerabilitiesRequest",
            };

            DefaultConfiguration.ConfigureSonarCloud(new UnversionedRequestFactory(logger));

            DumpDebugMessages(logger);

            logger.DebugMessages.Should().ContainInOrder(expected);
            logger.DebugMessages.Count.Should().Be(expected.Length);
        }
        public IRequestFactory Select(bool isSonarCloud, ILogger logger)
        {
            if (isSonarCloud)
            {
                logger.Debug("Selected SonarCloud request factory");
                return(DefaultConfiguration.ConfigureSonarCloud(new UnversionedRequestFactory(logger)));
            }

            logger.Debug("Selected SonarQube request factory");
            return(DefaultConfiguration.ConfigureSonarQube(new RequestFactory(logger)));
        }