public PackageValidator Create( string galleryUrl, string indexUrl, StorageFactory auditingStorageFactory, IEnumerable <EndpointFactory.Input> endpointInputs, Func <HttpMessageHandler> messageHandlerFactory, ValidatorConfiguration validatorConfig, bool verbose = false) { if (string.IsNullOrEmpty(galleryUrl)) { throw new ArgumentException(Strings.ArgumentMustNotBeNullOrEmpty, nameof(galleryUrl)); } if (string.IsNullOrEmpty(indexUrl)) { throw new ArgumentException(Strings.ArgumentMustNotBeNullOrEmpty, nameof(indexUrl)); } if (auditingStorageFactory == null) { throw new ArgumentNullException(nameof(auditingStorageFactory)); } if (endpointInputs == null) { throw new ArgumentNullException(nameof(endpointInputs)); } if (messageHandlerFactory == null) { throw new ArgumentNullException(nameof(messageHandlerFactory)); } if (validatorConfig == null) { throw new ArgumentNullException(nameof(validatorConfig)); } var validatorFactory = new ValidatorFactory(validatorConfig, _loggerFactory); var endpointFactory = new EndpointFactory(validatorFactory, messageHandlerFactory, _loggerFactory); var validators = new List <IAggregateValidator>(); validators.AddRange(endpointInputs.Select(e => endpointFactory.Create(e))); validators.Add(new CatalogAggregateValidator(validatorFactory, validatorConfig)); var feedToSource = new Dictionary <FeedType, SourceRepository>() { { FeedType.HttpV2, new SourceRepository(new PackageSource(galleryUrl), GetResourceProviders(ResourceProvidersToInjectV2), FeedType.HttpV2) }, { FeedType.HttpV3, new SourceRepository(new PackageSource(indexUrl), GetResourceProviders(ResourceProvidersToInjectV3), FeedType.HttpV3) } }; return(new PackageValidator( validators, auditingStorageFactory, feedToSource, _loggerFactory.CreateLogger <PackageValidator>(), _loggerFactory.CreateLogger <ValidationContext>())); }
public PackageValidator Create( string galleryUrl, string indexUrl, string packageBaseAddress, StorageFactory auditingStorageFactory, IEnumerable <EndpointFactory.Input> endpointInputs, Func <HttpMessageHandler> messageHandlerFactory, bool requireSignature = false, bool verbose = false) { var validatorFactory = new ValidatorFactoryFactory(_loggerFactory).Create(galleryUrl, indexUrl, packageBaseAddress); var endpointFactory = new EndpointFactory(validatorFactory, messageHandlerFactory, _loggerFactory); var validators = new List <IAggregateValidator>(); validators.AddRange(endpointInputs.Select(e => endpointFactory.Create(e))); validators.Add(new CatalogAggregateValidator(validatorFactory, requireSignature)); return(new PackageValidator(validators, auditingStorageFactory, _loggerFactory.CreateLogger <PackageValidator>())); }