public ExperimentsController(
     ISearchSideBySideService searchSideBySideService,
     IFeatureFlagService featureFlagService)
 {
     _searchSideBySideService = searchSideBySideService ?? throw new ArgumentNullException(nameof(searchSideBySideService));
     _featureFlagService      = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
 }
Example #2
0
 public MainPageViewModel(INavigationService navigationService, IPageDialogService pageDialogService,
                          IDeviceService deviceService, IFeatureFlagService featureFlagService)
     : base(navigationService, pageDialogService, deviceService)
 {
     _featureFlagService = featureFlagService;
     Title = "Main Page";
 }
Example #3
0
 public OrganizationsController(
     AuthenticationService authService,
     IMessageService messageService,
     IUserService userService,
     ITelemetryService telemetryService,
     ISecurityPolicyService securityPolicyService,
     ICertificateService certificateService,
     IPackageService packageService,
     IDeleteAccountService deleteAccountService,
     IContentObjectService contentObjectService,
     IMessageServiceConfiguration messageServiceConfiguration,
     IIconUrlProvider iconUrlProvider,
     IFeatureFlagService features,
     IGravatarProxyService gravatarProxy)
     : base(
         authService,
         packageService,
         messageService,
         userService,
         telemetryService,
         securityPolicyService,
         certificateService,
         contentObjectService,
         messageServiceConfiguration,
         deleteAccountService,
         iconUrlProvider,
         gravatarProxy)
 {
     _features = features ?? throw new ArgumentNullException(nameof(features));
 }
Example #4
0
 public PackageUploadService(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IReservedNamespaceService reservedNamespaceService,
     IValidationService validationService,
     IAppConfiguration config,
     ITyposquattingService typosquattingService,
     ITelemetryService telemetryService,
     ICoreLicenseFileService coreLicenseFileService,
     IDiagnosticsService diagnosticsService,
     IFeatureFlagService featureFlagService,
     IPackageVulnerabilityService vulnerabilityService)
 {
     _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
     _config = config ?? throw new ArgumentNullException(nameof(config));
     _typosquattingService   = typosquattingService ?? throw new ArgumentNullException(nameof(typosquattingService));
     _telemetryService       = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     _coreLicenseFileService = coreLicenseFileService ?? throw new ArgumentNullException(nameof(coreLicenseFileService));
     if (diagnosticsService == null)
     {
         throw new ArgumentNullException(nameof(diagnosticsService));
     }
     _trace = diagnosticsService.GetSource(nameof(PackageUploadService));
     _featureFlagService   = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
     _vulnerabilityService = vulnerabilityService ?? throw new ArgumentNullException(nameof(vulnerabilityService));
 }
Example #5
0
 public JudiciaryPersonController(IQueryHandler queryHandler, ICommandHandler commandHandler, ILogger <JudiciaryPersonController> logger, IFeatureFlagService flagsService)
 {
     _queryHandler   = queryHandler;
     _commandHandler = commandHandler;
     _logger         = logger;
     _flagsService   = flagsService;
 }
 protected abstract TController CreateController(
     IReadOnlyEntityRepository <Package> packagesRepository,
     IEntityRepository <Package> readWritePackagesRepository,
     IGalleryConfigurationService configurationService,
     ISearchService searchService,
     ITelemetryService telemetryService,
     IFeatureFlagService featureFlagService);
Example #7
0
 public PackageDeprecationManagementService(
     IPackageService packageService,
     IFeatureFlagService featureFlagService,
     IPackageDeprecationService deprecationService)
 {
     _packageService     = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _featureFlagService = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
     _deprecationService = deprecationService ?? throw new ArgumentNullException(nameof(deprecationService));
 }
Example #8
0
 public ManageDeprecationJsonApiController(
     IPackageService packageService,
     IPackageDeprecationService deprecationService,
     IFeatureFlagService featureFlagService)
 {
     _packageService     = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _deprecationService = deprecationService ?? throw new ArgumentNullException(nameof(deprecationService));
     _featureFlagService = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
 }
 public LoginPageViewModel(
     INavigationService navigationService,
     IPageDialogService pageDialogService,
     IDeviceService deviceService,
     IFeatureFlagService featureFlagService) : base(navigationService, pageDialogService, deviceService)
 {
     _featureFlagService = featureFlagService;
     Title        = "Login";
     LoginCommand = new Command(HandleAction);
 }
 public ManageDeprecationJsonApiController(
     IVulnerabilityAutocompleteService vulnerabilityAutocompleteService,
     IPackageService packageService,
     IPackageDeprecationService deprecationService,
     IFeatureFlagService featureFlagService)
 {
     _vulnerabilityAutocompleteService = vulnerabilityAutocompleteService ?? throw new ArgumentNullException(nameof(vulnerabilityAutocompleteService));
     _packageService     = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _deprecationService = deprecationService ?? throw new ArgumentNullException(nameof(deprecationService));
     _featureFlagService = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
 }
Example #11
0
 public GravatarProxyService(
     IHttpClientFactory httpClientFactory,
     IEntityRepository <User> users,
     IFeatureFlagService features,
     ILogger <GravatarProxyService> logger)
 {
     _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
     _users             = users ?? throw new ArgumentNullException(nameof(users));
     _features          = features ?? throw new ArgumentNullException(nameof(features));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public CloudDownloadCountService(
     ITelemetryService telemetryService,
     IFeatureFlagService featureFlagService,
     IBlobStorageConfiguration primaryBlobStorageConfiguration,
     IBlobStorageConfiguration alternateBlobStorageConfiguration)
 {
     _telemetryService                  = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     _featureFlagService                = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
     _primaryStorageConfiguration       = primaryBlobStorageConfiguration ?? throw new ArgumentNullException(nameof(primaryBlobStorageConfiguration));
     _alternateBlobStorageConfiguration = alternateBlobStorageConfiguration;
 }
Example #13
0
        public void EmptyConfiguration_Should_ReturnFalse()
        {
            var testFlagName      = "dummyFlag";
            var configSectionName = "featureFlags";
            var config            = new Dictionary <string, string>()
            {
            };

            IFeatureFlagService featureFlagService = GetConfigBasedFlagService(config, configSectionName);

            Assert.False(featureFlagService.IsEnabled(testFlagName));
        }
        public CustomersControllerTests()
        {
            // Arrange
            var services = new ServiceCollection();

            services.AddTransient <ICustomerDataService, MockCustomerDataService>();
            services.AddTransient <IFeatureFlagService, MockFeaureFlagService>();
            var serviceProvider = services.BuildServiceProvider();

            _customerDataService = serviceProvider.GetService <ICustomerDataService>();
            _featureFlagService  = serviceProvider.GetService <IFeatureFlagService>();
        }
        public AutocompleteServiceQuery(IAppConfiguration configuration, IResilientSearchClient resilientSearchClient, IFeatureFlagService featureFlagService)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            _serviceDiscoveryClient          = new ServiceDiscoveryClient(configuration.ServiceDiscoveryUri);
            _autocompleteServiceResourceType = configuration.AutocompleteServiceResourceType;
            _httpClientToDeprecate           = new RetryingHttpClientWrapper(new HttpClient(), QuietLog.LogHandledException);
            _resilientSearchClient           = resilientSearchClient;
            _featureFlagService = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
        }
Example #16
0
 public SymbolsValidatorMessageHandler(
     ISymbolsValidatorService symbolValidatorService,
     IValidatorStateService validatorStateService,
     IPackageValidationEnqueuer validationEnqueuer,
     IFeatureFlagService featureFlagService,
     ILogger <SymbolsValidatorMessageHandler> logger)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _symbolValidatorService = symbolValidatorService ?? throw new ArgumentNullException(nameof(symbolValidatorService));
     _validatorStateService  = validatorStateService ?? throw new ArgumentNullException(nameof(validatorStateService));
     _validationEnqueuer     = validationEnqueuer ?? throw new ArgumentNullException(nameof(validationEnqueuer));
     _featureFlagService     = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
 }
Example #17
0
        public void ExistingFlag_Should_ReturnTrue()
        {
            var testFlagName      = "dummyFlag";
            var configSectionName = "featureFlags";
            var config            = new Dictionary <string, string>()
            {
                [$"{configSectionName}:{testFlagName}:Enabled"] = "true",
            };

            IFeatureFlagService featureFlagService = GetConfigBasedFlagService(config, configSectionName);

            Assert.True(featureFlagService.IsEnabled(testFlagName));
        }
Example #18
0
 public void InitializePublisher(IExecutionContext context, string projectName, VssConnection connection, string testRunner, bool publishRunLevelAttachments)
 {
     Trace.Entering();
     _executionContext   = context;
     _projectName        = projectName;
     _testRunner         = testRunner;
     _resultReader       = GetTestResultReader(_testRunner, publishRunLevelAttachments);
     _testRunPublisher   = HostContext.GetService <ITestRunPublisher>();
     _featureFlagService = HostContext.GetService <IFeatureFlagService>();
     _testRunPublisher.InitializePublisher(_executionContext, connection, projectName, _resultReader);
     _calculateTestRunSummary = _featureFlagService.GetFeatureFlagState(TestResultsConstants.CalculateTestRunSummaryFeatureFlag, TestResultsConstants.TFSServiceInstanceGuid);
     Trace.Leaving();
 }
Example #19
0
 public HijackSearchServiceFactory(
     HttpContextBase httpContext,
     IFeatureFlagService featureFlags,
     IContentObjectService contentObjectService,
     ISearchService search,
     ISearchService previewSearch)
 {
     _httpContext          = httpContext ?? throw new ArgumentNullException(nameof(httpContext));
     _featureFlags         = featureFlags ?? throw new ArgumentNullException(nameof(featureFlags));
     _contentObjectService = contentObjectService ?? throw new ArgumentNullException(nameof(contentObjectService));
     _search        = search ?? throw new ArgumentNullException(nameof(search));
     _previewSearch = previewSearch ?? throw new ArgumentNullException(nameof(previewSearch));
 }
Example #20
0
 public TyposquattingService(IContentObjectService contentObjectService,
                             IFeatureFlagService featureFlagService,
                             IPackageService packageService,
                             IReservedNamespaceService reservedNamespaceService,
                             ITelemetryService telemetryService,
                             ITyposquattingCheckListCacheService typosquattingCheckListCacheService)
 {
     _contentObjectService               = contentObjectService ?? throw new ArgumentNullException(nameof(contentObjectService));
     _featureFlagService                 = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
     _packageService                     = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _reservedNamespaceService           = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _telemetryService                   = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     _typosquattingCheckListCacheService = typosquattingCheckListCacheService ?? throw new ArgumentNullException(nameof(typosquattingCheckListCacheService));
 }
 public ODataV1FeedController(
     IReadOnlyEntityRepository <Package> packagesRepository,
     IEntityRepository <Package> readWritePackagesRepository,
     IGalleryConfigurationService configurationService,
     IHijackSearchServiceFactory searchServiceFactory,
     ITelemetryService telemetryService,
     IFeatureFlagService featureFlagService)
     : base(configurationService, telemetryService)
 {
     _packagesRepository          = packagesRepository ?? throw new ArgumentNullException(nameof(packagesRepository));
     _readWritePackagesRepository = readWritePackagesRepository ?? throw new ArgumentNullException(nameof(readWritePackagesRepository));
     _configurationService        = configurationService ?? throw new ArgumentNullException(nameof(configurationService));
     _searchServiceFactory        = searchServiceFactory ?? throw new ArgumentNullException(nameof(searchServiceFactory));
     _featureFlagService          = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
 }
 public JsonApiController(
     IPackageService packageService,
     IUserService userService,
     IMessageService messageService,
     IAppConfiguration appConfiguration,
     IPackageOwnershipManagementService packageOwnershipManagementService,
     IFeatureFlagService features)
 {
     _packageService   = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _userService      = userService ?? throw new ArgumentNullException(nameof(userService));
     _messageService   = messageService ?? throw new ArgumentNullException(nameof(messageService));
     _appConfiguration = appConfiguration ?? throw new ArgumentNullException(nameof(appConfiguration));
     _packageOwnershipManagementService = packageOwnershipManagementService ?? throw new ArgumentNullException(nameof(packageOwnershipManagementService));
     _features = features ?? throw new ArgumentNullException(nameof(features));
 }
Example #23
0
 /// <summary>
 /// Instantiate's a new package signatures validator.
 /// </summary>
 /// <param name="httpClient">The HTTP client used to download packages.</param>
 /// <param name="validatorStateService">The service used to retrieve and persist this validator's state.</param>
 /// <param name="packageSigningStateService">The service used to retrieve and persist package signing state.</param>
 /// <param name="logger">The logger that should be used.</param>
 public SignatureValidationMessageHandler(
     IFileDownloader packageDownloader,
     IValidatorStateService validatorStateService,
     ISignatureValidator signatureValidator,
     IPackageValidationEnqueuer validationEnqueuer,
     IFeatureFlagService featureFlagService,
     ILogger <SignatureValidationMessageHandler> logger)
 {
     _packageDownloader     = packageDownloader ?? throw new ArgumentNullException(nameof(packageDownloader));
     _validatorStateService = validatorStateService ?? throw new ArgumentNullException(nameof(validatorStateService));
     _signatureValidator    = signatureValidator ?? throw new ArgumentNullException(nameof(signatureValidator));
     _validationEnqueuer    = validationEnqueuer ?? throw new ArgumentNullException(nameof(validationEnqueuer));
     _featureFlagService    = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public TestableV2Feed(
     IReadOnlyEntityRepository <Package> repo,
     IGalleryConfigurationService configuration,
     ISearchService searchService,
     ITelemetryService telemetryService,
     IFeatureFlagService featureFlagService)
     : base(
         repo,
         Mock.Of <IEntityRepository <Package> >(),
         configuration,
         GetSearchServiceFactory(searchService),
         telemetryService,
         featureFlagService)
 {
 }
Example #25
0
 public PagesController(
     IContentService contentService,
     IContentObjectService contentObjectService,
     IMessageService messageService,
     ISupportRequestService supportRequestService,
     IMessageServiceConfiguration messageServiceConfiguration,
     IFeatureFlagService featureFlagService)
 {
     _contentService              = contentService ?? throw new ArgumentNullException(nameof(contentService));
     _contentObjectService        = contentObjectService ?? throw new ArgumentNullException(nameof(contentObjectService));
     _messageService              = messageService ?? throw new ArgumentNullException(nameof(messageService));
     _supportRequestService       = supportRequestService ?? throw new ArgumentNullException(nameof(supportRequestService));
     _messageServiceConfiguration = messageServiceConfiguration ?? throw new ArgumentNullException(nameof(messageServiceConfiguration));
     _featureFlagService          = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
 }
        public void InitializePublisher(IExecutionContext context, string projectName, VssConnection connection, string testRunner)
        {
            Trace.Entering();
            _executionContext = context;
            _projectName      = projectName;
            _connection       = connection;
            _testRunner       = testRunner;
            _testRunPublisher = new TestRunPublisher(connection, new CommandTraceListener(context));
            _testLogStore     = new TestLogStore(connection, new CommandTraceListener(context));

            var extensionManager = HostContext.GetService <IExtensionManager>();

            _featureFlagService = HostContext.GetService <IFeatureFlagService>();
            _parser             = (extensionManager.GetExtensions <IParser>()).FirstOrDefault(x => _testRunner.Equals(x.Name, StringComparison.OrdinalIgnoreCase));
            Trace.Leaving();
        }
Example #27
0
 protected override ODataV2FeedController CreateController(
     IReadOnlyEntityRepository <Package> packagesRepository,
     IEntityRepository <Package> readWritePackagesRepository,
     IGalleryConfigurationService configurationService,
     ISearchService searchService,
     ITelemetryService telemetryService,
     IFeatureFlagService featureFlagService)
 {
     return(new ODataV2FeedController(
                packagesRepository,
                readWritePackagesRepository,
                configurationService,
                searchService,
                telemetryService,
                featureFlagService));
 }
Example #28
0
        public ExternalSearchService(IAppConfiguration config, IDiagnosticsService diagnostics, ISearchClient searchClient, IFeatureFlagService featureFlagService)
        {
            ServiceUri          = config.ServiceDiscoveryUri;
            _searchClient       = searchClient ?? throw new ArgumentNullException(nameof(searchClient));
            _featureFlagService = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));

            Trace = diagnostics.SafeGetSource("ExternalSearchService");

            // Extract credentials
            var          userInfo    = ServiceUri.UserInfo;
            ICredentials credentials = null;

            if (!String.IsNullOrEmpty(userInfo))
            {
                var split = userInfo.Split(':');
                if (split.Length != 2)
                {
                    throw new FormatException("Invalid user info in SearchServiceUri!");
                }

                // Split the credentials out
                credentials = new NetworkCredential(split[0], split[1]);
                ServiceUri  = new UriBuilder(ServiceUri)
                {
                    UserName = null,
                    Password = null
                }.Uri;
            }

            // note: intentionally not locking the next two assignments to avoid blocking calls
            if (_healthIndicatorStore == null)
            {
                _healthIndicatorStore = new BaseUrlHealthIndicatorStore(new AppInsightsHealthIndicatorLogger());
            }

            if (_deprecatedSearchClient == null)
            {
                _deprecatedSearchClient = new SearchClient(
                    ServiceUri,
                    config.SearchServiceResourceType,
                    credentials,
                    _healthIndicatorStore,
                    QuietLog.LogHandledException,
                    new TracingHttpHandler(Trace),
                    new CorrelatingHttpClientHandler());
            }
        }
        public UpdateDownloadsCommand(
            IAuxiliaryFileClient auxiliaryFileClient,
            IDatabaseAuxiliaryDataFetcher databaseFetcher,
            IDownloadDataClient downloadDataClient,
            IDownloadSetComparer downloadSetComparer,
            IDownloadTransferrer downloadTransferrer,
            IPopularityTransferDataClient popularityTransferDataClient,
            ISearchDocumentBuilder searchDocumentBuilder,
            ISearchIndexActionBuilder indexActionBuilder,
            Func <IBatchPusher> batchPusherFactory,
            ISystemTime systemTime,
            IFeatureFlagService featureFlags,
            IOptionsSnapshot <Auxiliary2AzureSearchConfiguration> options,
            IAzureSearchTelemetryService telemetryService,
            ILogger <Auxiliary2AzureSearchCommand> logger)
        {
            _auxiliaryFileClient          = auxiliaryFileClient ?? throw new ArgumentException(nameof(auxiliaryFileClient));
            _databaseFetcher              = databaseFetcher ?? throw new ArgumentNullException(nameof(databaseFetcher));
            _downloadDataClient           = downloadDataClient ?? throw new ArgumentNullException(nameof(downloadDataClient));
            _downloadSetComparer          = downloadSetComparer ?? throw new ArgumentNullException(nameof(downloadSetComparer));
            _downloadTransferrer          = downloadTransferrer ?? throw new ArgumentNullException(nameof(downloadTransferrer));
            _popularityTransferDataClient = popularityTransferDataClient ?? throw new ArgumentNullException(nameof(popularityTransferDataClient));
            _searchDocumentBuilder        = searchDocumentBuilder ?? throw new ArgumentNullException(nameof(searchDocumentBuilder));
            _indexActionBuilder           = indexActionBuilder ?? throw new ArgumentNullException(nameof(indexActionBuilder));
            _batchPusherFactory           = batchPusherFactory ?? throw new ArgumentNullException(nameof(batchPusherFactory));
            _systemTime       = systemTime ?? throw new ArgumentNullException(nameof(systemTime));
            _featureFlags     = featureFlags ?? throw new ArgumentNullException(nameof(featureFlags));
            _options          = options ?? throw new ArgumentNullException(nameof(options));
            _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
            _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
            _stringCache      = new StringCache();

            if (_options.Value.MaxConcurrentBatches <= 0)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(options),
                          $"The {nameof(AzureSearchJobConfiguration.MaxConcurrentBatches)} must be greater than zero.");
            }

            if (_options.Value.MaxConcurrentVersionListWriters <= 0)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(options),
                          $"The {nameof(AzureSearchJobConfiguration.MaxConcurrentVersionListWriters)} must be greater than zero.");
            }
        }
        public CertificateValidationMessageHandler(
            ICertificateStore certificateStore,
            ICertificateValidationService certificateValidationService,
            ICertificateVerifier certificateVerifier,
            IPackageValidationEnqueuer validationEnqueuer,
            IFeatureFlagService featureFlagService,
            ILogger <CertificateValidationMessageHandler> logger,
            int maximumValidationFailures = CertificateValidationService.DefaultMaximumValidationFailures)
        {
            _certificateStore             = certificateStore ?? throw new ArgumentNullException(nameof(certificateStore));
            _certificateValidationService = certificateValidationService ?? throw new ArgumentNullException(nameof(certificateValidationService));
            _certificateVerifier          = certificateVerifier ?? throw new ArgumentNullException(nameof(certificateVerifier));
            _validationEnqueuer           = validationEnqueuer ?? throw new ArgumentNullException(nameof(validationEnqueuer));
            _featureFlagService           = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _maximumValidationFailures = maximumValidationFailures;
        }