Example #1
0
        public async Task FindFile_NoCacheAsync()
        {
            await storeA.AddFileAsync(sourceSymbolFile, FILENAME, BUILD_ID);

            storeSequence.AddStore(storeA);

            var fileReference = await storeSequence.FindFileAsync(FILENAME, BUILD_ID);

            Assert.AreEqual((await storeA.FindFileAsync(FILENAME, BUILD_ID)).Location,
                            fileReference.Location);
        }
        public async Task FindFile_SingleStoreAsync()
        {
            await storeA.AddFileAsync(sourceSymbolFile, FILENAME, BUILD_ID);

            symbolServer.AddStore(storeA);

            var fileReference = await symbolServer.FindFileAsync(FILENAME, BUILD_ID);

            Assert.AreEqual((await storeA.FindFileAsync(FILENAME, BUILD_ID)).Location,
                            fileReference.Location);
        }
Example #3
0
        public override async Task <IFileReference> FindFileAsync(string filename, BuildId buildId,
                                                                  bool isDebugInfoFile,
                                                                  TextWriter log)
        {
            if (string.IsNullOrEmpty(filename))
            {
                throw new ArgumentException(Strings.FilenameNullOrEmpty, "filename");
            }

            ISymbolStore currentCache = null;

            foreach (var store in _stores)
            {
                IFileReference fileReference =
                    await store.FindFileAsync(filename, buildId, false, log);

                if (fileReference != null)
                {
                    if (!store.IsCache && currentCache != null)
                    {
                        try
                        {
                            fileReference = await currentCache.AddFileAsync(fileReference, filename,
                                                                            buildId, log);
                        }
                        catch (Exception e)
                            when(e is NotSupportedException || e is SymbolStoreException ||
                                 e is ArgumentException)
                            {
                                Trace.WriteLine(e.Message);
                                await log.WriteLineAsync(e.Message);
                            }
                    }

                    if (!fileReference.IsFilesystemLocation ||
                        await VerifySymbolFileAsync(fileReference.Location, buildId,
                                                    isDebugInfoFile, log))
                    {
                        return(fileReference);
                    }
                }

                if (store.IsCache)
                {
                    currentCache = store;
                }
            }

            return(null);
        }
Example #4
0
        public async Task FindFile_WithMultipeCachesAsync()
        {
            await storeB.AddFileAsync(sourceSymbolFile, FILENAME, BUILD_ID);

            storeSequence.AddStore(cacheA);
            storeSequence.AddStore(storeA);
            storeSequence.AddStore(cacheB);
            storeSequence.AddStore(storeB);

            var fileReference = await storeSequence.FindFileAsync(FILENAME, BUILD_ID);

            Assert.NotNull(await cacheB.FindFileAsync(FILENAME, BUILD_ID));
            Assert.Null(await cacheA.FindFileAsync(FILENAME, BUILD_ID));
            Assert.AreEqual((await cacheB.FindFileAsync(FILENAME, BUILD_ID)).Location,
                            fileReference.Location);
        }