public TestBase() { PackageStorageMock = new Mock <IAzureStorage>(); IconProcessorMock = new Mock <IIconProcessor>(); ExternalIconContentProviderMock = new Mock <IExternalIconContentProvider>(); IconCopyResultCacheMock = new Mock <IIconCopyResultCache>(); TelemetryServiceMock = new Mock <ITelemetryService>(); LoggerMock = new Mock <ILogger <CatalogLeafDataProcessor> >(); DestinationStorageMock = new Mock <IStorage>(); IconCacheStorageMock = new Mock <IStorage>(); TelemetryServiceMock .Setup(ts => ts.TrackEmbeddedIconProcessingDuration(It.IsAny <string>(), It.IsAny <string>())) .Returns(Mock.Of <IDisposable>()); TelemetryServiceMock .Setup(ts => ts.TrackExternalIconProcessingDuration(It.IsAny <string>(), It.IsAny <string>())) .Returns(Mock.Of <IDisposable>()); DestinationStorageMock .Setup(ds => ds.ResolveUri(It.IsAny <string>())) .Returns(new Uri(ResolvedUriString)); Target = new CatalogLeafDataProcessor( PackageStorageMock.Object, IconProcessorMock.Object, ExternalIconContentProviderMock.Object, IconCopyResultCacheMock.Object, TelemetryServiceMock.Object, LoggerMock.Object); }
protected override void Init(IDictionary <string, string> arguments, CancellationToken cancellationToken) { ServicePointManager.DefaultConnectionLimit = DegreeOfParallelism; var verbose = arguments.GetOrDefault(Arguments.Verbose, false); var packageStorageBase = arguments.GetOrThrow <string>(Arguments.ContentBaseAddress); var failCacheTime = arguments.GetOrDefault(FailCacheTime, TimeSpan.FromHours(1)); var auxStorageFactory = CreateAuxStorageFactory(arguments, verbose); var targetStorageFactory = CreateTargetStorageFactory(arguments, verbose); var packageStorage = new AzureStorage( storageBaseUri: new Uri(packageStorageBase), maxExecutionTime: TimeSpan.FromMinutes(15), serverTimeout: TimeSpan.FromMinutes(10), useServerSideCopy: true, compressContent: false, verbose: true, throttle: null); var source = arguments.GetOrThrow <string>(Arguments.Source); var iconProcessor = new IconProcessor(TelemetryService, LoggerFactory.CreateLogger <IconProcessor>()); var httpHandlerFactory = CommandHelpers.GetHttpMessageHandlerFactory(TelemetryService, verbose); var httpMessageHandler = httpHandlerFactory(); var httpClient = new HttpClient(httpMessageHandler); var simpleHttpClient = new SimpleHttpClient(httpClient, LoggerFactory.CreateLogger <SimpleHttpClient>()); var catalogClient = new CatalogClient(simpleHttpClient, LoggerFactory.CreateLogger <CatalogClient>()); var httpResponseProvider = new HttpClientWrapper(httpClient); var externalIconProvider = new ExternalIconContentProvider(httpResponseProvider, LoggerFactory.CreateLogger <ExternalIconContentProvider>()); var iconCopyResultCache = new IconCopyResultCache(auxStorageFactory.Create(), failCacheTime, LoggerFactory.CreateLogger <IconCopyResultCache>()); var leafProcessor = new CatalogLeafDataProcessor( packageStorage, iconProcessor, externalIconProvider, iconCopyResultCache, TelemetryService, LoggerFactory.CreateLogger <CatalogLeafDataProcessor>()); _collector = new IconsCollector( new Uri(source), TelemetryService, targetStorageFactory, catalogClient, leafProcessor, iconCopyResultCache, auxStorageFactory, CommandHelpers.GetHttpMessageHandlerFactory(TelemetryService, verbose), LoggerFactory.CreateLogger <IconsCollector>()); var cursorStorage = auxStorageFactory.Create(); _front = new DurableCursor(cursorStorage.ResolveUri("c2icursor.json"), cursorStorage, DateTime.MinValue.ToUniversalTime()); }