Exemple #1
0
            private async Task ProcessGraphsAsync()
            {
                await RegistrationMaker.ProcessAsync(
                    new RegistrationKey(_packageId),
                    _sortedGraphs,
                    _job._shouldIncludeSemVer2ForLegacyStorageFactory,
                    _job._storageFactories.LegacyStorageFactory,
                    _job._postProcessGraphForLegacyStorageFactory,
                    new Uri(_job._contentBaseAddress),
                    new Uri(_job._galleryBaseAddress),
                    RegistrationCollector.PartitionSize,
                    RegistrationCollector.PackageCountThreshold,
                    _job._forceIconsFromFlatContainer,
                    _job.TelemetryService,
                    CancellationToken.None);

                if (_job._storageFactories.SemVer2StorageFactory != null)
                {
                    await RegistrationMaker.ProcessAsync(
                        new RegistrationKey(_packageId),
                        _sortedGraphs,
                        _job._storageFactories.SemVer2StorageFactory,
                        new Uri(_job._contentBaseAddress),
                        new Uri(_job._galleryBaseAddress),
                        RegistrationCollector.PartitionSize,
                        RegistrationCollector.PackageCountThreshold,
                        _job._forceIconsFromFlatContainer,
                        _job.TelemetryService,
                        CancellationToken.None);
                }
            }
Exemple #2
0
        public static async Task Test1Async()
        {
            string path = "c:\\data\\test";

            DirectoryInfo directoryInfo = new DirectoryInfo(path);

            if (directoryInfo.Exists)
            {
                directoryInfo.Delete(true);
            }
            directoryInfo.Create();

            FileStorageFactory factory = new FileStorageFactory(new Uri("http://tempuri.org"), path);

            await RegistrationMaker.Process(new RegistrationKey("mypackage"), CreateTestSingleEntryBatch("mypackage", "1.0.0"), factory, new Uri("http://content/"), 2, 3);

            await RegistrationMaker.Process(new RegistrationKey("mypackage"), CreateTestSingleEntryBatch("mypackage", "2.0.0"), factory, new Uri("http://content/"), 2, 3);

            await RegistrationMaker.Process(new RegistrationKey("mypackage"), CreateTestSingleEntryBatch("mypackage", "3.0.0"), factory, new Uri("http://content/"), 2, 3);

            await RegistrationMaker.Process(new RegistrationKey("mypackage"), CreateTestSingleEntryBatch("mypackage", "4.0.0"), factory, new Uri("http://content/"), 2, 3);

            await RegistrationMaker.Process(new RegistrationKey("mypackage"), CreateTestSingleEntryBatch("mypackage", "5.0.0"), factory, new Uri("http://content/"), 2, 3);

            await RegistrationMaker.Process(new RegistrationKey("mypackage"), CreateTestSingleEntryBatch("mypackage", "6.0.0"), factory, new Uri("http://content/"), 2, 3);
        }
        private async Task ProcessGraphsAsync(string packageId, IReadOnlyDictionary <string, IGraph> sortedGraphs)
        {
            await RegistrationMaker.ProcessAsync(
                new RegistrationKey(packageId),
                sortedGraphs,
                _shouldIncludeSemVer2,
                _storageFactories.LegacyStorageFactory,
                new Uri(_contentBaseAddress),
                RegistrationCollector.PartitionSize,
                RegistrationCollector.PackageCountThreshold,
                TelemetryService,
                CancellationToken.None);

            if (_storageFactories.SemVer2StorageFactory != null)
            {
                await RegistrationMaker.ProcessAsync(
                    new RegistrationKey(packageId),
                    sortedGraphs,
                    _storageFactories.SemVer2StorageFactory,
                    new Uri(_contentBaseAddress),
                    RegistrationCollector.PartitionSize,
                    RegistrationCollector.PackageCountThreshold,
                    TelemetryService,
                    CancellationToken.None);
            }
        }
        private async Task <MemoryStorage> ProcessAsync(
            IReadOnlyDictionary <string, IGraph> newItems,
            string packageId,
            int partitionSize,
            int packageCountThreshold = _defaultPackageCountThreshold,
            bool filterOutDeprecation = false)
        {
            var registrationKey = new RegistrationKey(packageId?.ToLowerInvariant() ?? string.Empty);

            await RegistrationMaker.ProcessAsync(
                registrationKey,
                newItems,
                (g, u, k) => true,
                _storageFactory,
                filterOutDeprecation?RegistrationCollector.FilterOutDeprecationInformation : g => g,
                _contentBaseAddress,
                _galleryBaseAddress,
                partitionSize,
                packageCountThreshold,
                forcePackagePathProviderForIcons : false,
                telemetryService : _telemetryService.Object,
                cancellationToken : CancellationToken.None);

            return((MemoryStorage)_storageFactory.Create(registrationKey.ToString()));
        }
        private async Task <MemoryStorage> ProcessAsync(
            IReadOnlyDictionary <string, IGraph> newItems,
            string packageId,
            int partitionSize,
            int packageCountThreshold = _defaultPackageCountThreshold)
        {
            var registrationKey = new RegistrationKey(packageId?.ToLowerInvariant() ?? string.Empty);

            await RegistrationMaker.ProcessAsync(
                registrationKey,
                newItems,
                _storageFactory,
                _contentBaseAddress,
                partitionSize,
                packageCountThreshold,
                _telemetryService.Object,
                CancellationToken.None);

            return((MemoryStorage)_storageFactory.Create(registrationKey.ToString()));
        }
Exemple #6
0
        public static async Task Test0Async()
        {
            string path = "c:\\data\\test";

            DirectoryInfo directoryInfo = new DirectoryInfo(path);

            if (directoryInfo.Exists)
            {
                directoryInfo.Delete(true);
            }
            directoryInfo.Create();

            IDictionary <string, IGraph> catalog = new Dictionary <string, IGraph>();

            //catalog.Add(CreateTestCatalogEntry("mypackage", "1.0.0"));
            //catalog.Add(CreateTestCatalogEntry("mypackage", "2.0.0"));
            catalog.Add(CreateTestCatalogEntry("mypackage", "3.0.0"));
            catalog.Add(CreateTestCatalogEntry("mypackage", "4.0.0"));
            catalog.Add(CreateTestCatalogEntry("mypackage", "5.0.0"));
            FileStorageFactory factory = new FileStorageFactory(new Uri("http://tempuri.org"), path);
            await RegistrationMaker.Process(new RegistrationKey("mypackage"), catalog, factory, new Uri("http://content/"), 2, 3);
        }