public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if ((psiFile.Language.Is<JavaScriptLanguage>() && !psiFile.Language.Is<JavaScriptWinRTLanguage>()) && (psiFile.GetProject() != null)) { psiFile.ProcessDescendants(new JasmineFileExplorer(myFactory, consumer, psiFile, interrupted, myJavaScriptDependencyManager.GetTransitiveDependencies(psiFile.GetSourceFile()))); } }
public FileExplorer(IUnitTestProvider provider, UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted) { if (file == null) { throw new ArgumentNullException("file"); } if (provider == null) { throw new ArgumentNullException("provider"); } _consumer = consumer; _file = file; _interrupted = interrupted; IProject project = file.ProjectFile.GetProject(); string assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath; var contextFactory = new ContextFactory(provider, project, assemblyPath); var contextSpecificationFactory = new ContextSpecificationFactory(provider, project); var behaviorFactory = new BehaviorFactory(provider, project); var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project); _elementHandlers = new List<IElementHandler> { new ContextElementHandler(contextFactory), new ContextSpecificationElementHandler(contextSpecificationFactory), new BehaviorElementHandler(behaviorFactory, behaviorSpecificationFactory) }; }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (psiFile.Language.Name != "CSHARP" && psiFile.Language.Name != "VBASIC") return; psiFile.ProcessDescendants(new XunitFileExplorer(provider, psiFile.GetSourceFile().ToProjectFile(), consumer, interrupted)); }
public FileExplorer(MSpecUnitTestProvider provider, ElementFactories factories, IFile file, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (file == null) { throw new ArgumentNullException("file"); } if (provider == null) { throw new ArgumentNullException("provider"); } _consumer = consumer; _file = file; _interrupted = interrupted; var project = file.GetSourceFile().ToProjectFile().GetProject(); #if !RESHARPER_8 _assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath; #else _assemblyPath = project.GetOutputFilePath().FullPath; #endif _elementHandlers = new List<IElementHandler> { new ContextElementHandler(factories), new ContextSpecificationElementHandler(factories), new BehaviorElementHandler(factories) }; }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if ((psiFile.Language.Name == "CSHARP") || (psiFile.Language.Name == "VBASIC")) { psiFile.ProcessDescendants(new FileExplorer(_provider, _factories, psiFile, consumer, interrupted)); } }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (psiFile.Language.Name != "CSHARP" && psiFile.Language.Name != "VBASIC") return; psiFile.ProcessDescendants(new XunitFileExplorer(factory, psiFile, searchDomainFactory, consumer, interrupted)); }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (!xUnitInstalled) return; if (provider == null) return; if (psiFile == null) throw new ArgumentNullException("psiFile"); var project = psiFile.GetProject(); if (project == null) return; if (project.GetAssemblyReferences().Any(IsSilverlightMscorlib)) return; var fileExplorers = psiFile.GetProject().GetSolution().GetComponents<IUnitTestFileExplorer>(); var xunitTestFileExplorer = fileExplorers.Single(e => e.GetType().FullName == "XunitContrib.Runner.ReSharper.UnitTestProvider.XunitTestFileExplorer"); var unitTestElementFactory = xunitTestFileExplorer.GetField<object>("unitTestElementFactory"); var xunitPsiFileExplorerType = xunitTestFileExplorer.GetType().Assembly.GetType("XunitContrib.Runner.ReSharper.UnitTestProvider.XunitPsiFileExplorer"); var xunitPsiFileExplorer = (IRecursiveElementProcessor)Activator.CreateInstance(xunitPsiFileExplorerType, provider, unitTestElementFactory, consumer, psiFile, interrupted); psiFile.ProcessDescendants(xunitPsiFileExplorer); }
public PsiFileExplorer(UnitTestElementFactory unitTestElementFactory, TestIdentifier conventionCheck, UnitTestElementLocationConsumer consumer, IFile psiFile, CheckForInterrupt interrupted) { this.unitTestElementFactory = unitTestElementFactory; this.conventionCheck = conventionCheck; this.consumer = consumer; this.psiFile = psiFile; this.interrupted = interrupted; }
public SimpleTestingPsiFileExplorer(UnitTestElementLocationConsumer consumer, IFile psiFile, CheckForInterrupt interrupted, SimpleTestingElementFactory elementFactory) { _consumer = consumer; _psiFile = psiFile; _interrupted = interrupted; _elementFactory = elementFactory; _specificationCollections = new Dictionary<ITypeElement, SpecificationContainerElement>(); }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (psiFile == null) { throw new ArgumentNullException("psiFile"); } psiFile.ProcessDescendants(new FileExplorer(this, consumer, psiFile, interrupted)); }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if ((psiFile.Language.Name == "CSHARP") || (psiFile.Language.Name == "VBASIC")) { RecursiveElementProcessorExtensions.ProcessDescendants(psiFile, new FileExplorer(_provider, #if RESHARPER_61 _manager, _psiModuleManager, _cacheManager, #endif consumer, psiFile, interrupted)); } }
public FileExplorer(MSpecUnitTestProvider provider, #if RESHARPER_61 IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager, #endif UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted) { if (file == null) { throw new ArgumentNullException("file"); } if (provider == null) { throw new ArgumentNullException("provider"); } _consumer = consumer; _file = file; _interrupted = interrupted; #if RESHARPER_6 IProject project = file.GetSourceFile().ToProjectFile().GetProject(); #else IProject project = file.ProjectFile.GetProject(); #endif var projectEnvoy = new ProjectModelElementEnvoy(project); string assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath; var cache = new ContextCache(); #if RESHARPER_61 var contextFactory = new ContextFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, assemblyPath, cache); var contextSpecificationFactory = new ContextSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache); var behaviorFactory = new BehaviorFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache); var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy); #else var contextFactory = new ContextFactory(provider, project, projectEnvoy, assemblyPath, cache); var contextSpecificationFactory = new ContextSpecificationFactory(provider, project, projectEnvoy, cache); var behaviorFactory = new BehaviorFactory(provider, project, projectEnvoy, cache); var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project, projectEnvoy); #endif _elementHandlers = new List<IElementHandler> { new ContextElementHandler(contextFactory), new ContextSpecificationElementHandler(contextSpecificationFactory), new BehaviorElementHandler(behaviorFactory, behaviorSpecificationFactory) }; }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (psiFile == null) throw new ArgumentNullException("psiFile"); var project = psiFile.GetProject(); if (project == null) return; psiFile.ProcessDescendants(new SimpleTestingPsiFileExplorer(consumer, psiFile, interrupted, _elementFactory)); }
public XunitFileExplorer([NotNull] XunitTestProvider provider, [NotNull] IProjectFile projectFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (provider == null) throw new ArgumentNullException("provider"); if (projectFile == null) throw new ArgumentNullException("projectFile"); this.consumer = consumer; this.provider = provider; this.interrupted = interrupted; this.projectFile = projectFile; project = this.projectFile.GetProject(); envoy = ProjectModelElementEnvoy.Create(project); }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { var psiProject = psiFile.GetProject(); var project = _environment.GetProject(psiProject.ProjectFile.Location.FullPath); var stories = project.GetStories(psiFile.GetProjectFile().Location.ToString()); foreach (var story in stories) { var range = new TextRange(0); UnitTestElementDisposition disposition = new UnitTestElementDisposition( new StorEvilStoryElement(_provider, null, psiProject,story.Summary, story.Id ), psiProject.ProjectFile, range, range); consumer(disposition); } }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (interrupted()) return; // don't bother going any further if there's isn't a project with a reference to the Fixie assembly var project = psiFile.GetProject(); if (project == null) return; if(project.GetModuleReferences().All(module => module.Name != "Fixie")) return; psiFile.ProcessDescendants(new PsiFileExplorer(unitTestElementFactory, conventionCheck, consumer, psiFile, interrupted)); }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { Func<bool> interruptedFunc = () => interrupted(); if (psiFile == null) throw new ArgumentNullException("psiFile"); var project = psiFile.GetProject(); if (project == null) return; if ((psiFile.Language.Name == "CSHARP") || (psiFile.Language.Name == "VBASIC")) { psiFile.ProcessDescendants(new FileExplorer(_provider, _factories, psiFile, consumer, interruptedFunc)); } }
public XunitFileExplorer([NotNull] XunitElementFactory factory, [NotNull] ITreeNode file, [NotNull] SearchDomainFactory searchDomainFactory, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (factory == null) throw new ArgumentNullException("factory"); if (searchDomainFactory == null) throw new ArgumentNullException("searchDomainFactory"); if (file == null) throw new ArgumentNullException("file"); this.factory = factory; this.searchDomainFactory = searchDomainFactory; this.consumer = consumer; this.interrupted = interrupted; projectFile = file.GetSourceFile().ToProjectFile(); if (projectFile != null) project = projectFile.GetProject(); envoy = ProjectModelElementEnvoy.Create(project); }
public JasmineFileExplorer(JasmineElementFactory factory, UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted, IEnumerable<IPsiSourceFile> referencedFiles) { _factory = factory; _consumer = consumer; _file = file; _interrupted = interrupted; _referencedFiles = (referencedFiles != null) ? (from f in referencedFiles where f.PrimaryPsiLanguage.IsExactly<JavaScriptLanguage>() select f.GetLocation().FullPath).ToArray<string>() : EmptyArray<string>.Instance; var element = file.GetSourceFile().ToProjectFile(); if (element != null) { _filename = element.Location.FullPath; } _project = _file.GetProject(); _projectFileEnvoy = ProjectModelElementEnvoy.Create(element); }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (!xUnitInstalled) return; if (provider == null) return; if (psiFile == null) throw new ArgumentNullException("psiFile"); var project = psiFile.GetProject(); if (project == null) return; if (project.GetAssemblyReferences().Any(IsSilverlightMscorlib)) return; var psiFileExplorer = (IRecursiveElementProcessor)Activator.CreateInstance(XunitPsiFileExplorerType, provider, consumer, psiFile, interrupted); psiFile.ProcessDescendants(psiFileExplorer); }
public FileExplorer(MSpecUnitTestProvider provider, IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager, UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted) { if (file == null) { throw new ArgumentNullException("file"); } if (provider == null) { throw new ArgumentNullException("provider"); } _consumer = consumer; _file = file; _interrupted = interrupted; var project = file.GetSourceFile().ToProjectFile().GetProject(); var projectEnvoy = new ProjectModelElementEnvoy(project); var assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath; var cache = new ElementCache(); var contextFactory = new ContextFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, assemblyPath, cache); var contextSpecificationFactory = new ContextSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache); var behaviorFactory = new BehaviorFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache); var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy); _elementHandlers = new List <IElementHandler> { new ContextElementHandler(contextFactory), new ContextSpecificationElementHandler(contextSpecificationFactory), new BehaviorElementHandler(behaviorFactory, behaviorSpecificationFactory) }; }
/// <summary> /// Explores given PSI file. /// </summary> public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (psiFile == null) { throw new ArgumentNullException("psiFile"); } if (consumer == null) { throw new ArgumentNullException("consumer"); } #if !RESHARPER_31 && !RESHARPER_40 && !RESHARPER_41 using (ReadLockCookie.Create()) #endif { if (!psiFile.IsValid()) { return; } try { PsiReflectionPolicy reflectionPolicy = new PsiReflectionPolicy(psiFile.GetManager()); ConsumerAdapter consumerAdapter = new ConsumerAdapter(provider, consumer, psiFile); var codeElements = new List <ICodeElementInfo>(); psiFile.ProcessDescendants(new OneActionProcessorWithoutVisit(delegate(IElement element) { ITypeDeclaration declaration = element as ITypeDeclaration; if (declaration != null) { PopulateCodeElementsFromTypeDeclaration(codeElements, reflectionPolicy, declaration); } }, delegate(IElement element) { if (interrupted()) { throw new ProcessCancelledException(); } // Stop recursing at the first type declaration found. return(element is ITypeDeclaration); })); Describe(reflectionPolicy, codeElements, consumerAdapter); ProjectFileState.SetFileState(psiFile.GetProjectFile(), consumerAdapter.CreateProjectFileState()); } catch (Exception ex) { HandleEmbeddedProcessCancelledException(ex); throw; } } }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if ((psiFile.Language.Is <JavaScriptLanguage>() && !psiFile.Language.Is <JavaScriptWinRTLanguage>()) && (psiFile.GetProject() != null)) { psiFile.ProcessDescendants(new JasmineFileExplorer(myFactory, consumer, psiFile, interrupted, myJavaScriptDependencyManager.GetTransitiveDependencies(psiFile.GetSourceFile()))); } }
/// <summary> /// Explores given PSI file. /// </summary> public void ExploreFile(ITreeNode psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (psiFile == null) { throw new ArgumentNullException("psiFile"); } if (consumer == null) { throw new ArgumentNullException("consumer"); } if (!psiFile.IsValid()) { return; } try { #if RESHARPER_60 var reflectionPolicy = new PsiReflectionPolicy(psiFile.GetPsiServices().PsiManager); #else var reflectionPolicy = new PsiReflectionPolicy(psiFile.GetPsiServices().PsiManager, provider.CacheManager); #endif var consumerAdapter = new ConsumerAdapter(provider, consumer, psiFile); var codeElements = new List <ICodeElementInfo>(); psiFile.ProcessDescendants(new OneActionProcessorWithoutVisit(delegate(ITreeNode element) { var declaration = element as ITypeDeclaration; if (declaration != null) { PopulateCodeElementsFromTypeDeclaration(codeElements, reflectionPolicy, declaration); } }, delegate(ITreeNode element) { if (interrupted()) { throw new ProcessCancelledException(); } // Stop recursing at the first type declaration found. return(element is ITypeDeclaration); })); Describe(reflectionPolicy, codeElements, consumerAdapter); ProjectFileState.SetFileState(psiFile.GetSourceFile().ToProjectFile(), consumerAdapter.CreateProjectFileState()); } catch (Exception ex) { HandleEmbeddedProcessCancelledException(ex); throw; } }
public MappingFileParser(ILexer lexer, CheckForInterrupt checkForInterrupt) { m_Lexer = lexer; m_CheckForInterrupt = checkForInterrupt; }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { Func <bool> interruptedFunc = () => interrupted(); if (psiFile == null) { throw new ArgumentNullException("psiFile"); } var project = psiFile.GetProject(); if (project == null) { return; } if ((psiFile.Language.Name == "CSHARP") || (psiFile.Language.Name == "VBASIC")) { psiFile.ProcessDescendants(new FileExplorer(_provider, _factories, psiFile, consumer, interruptedFunc)); } }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { Debug.WriteLine("ExploreFile " + psiFile.ProjectFile.Location); }
public L4NParser(ILexer lexer, CheckForInterrupt checkForInterrupt) : base(lexer, checkForInterrupt) { }
/// <summary> /// Retrieve the publications for a person and write them to the database /// </summary> /// <param name="ncbi">NCBI web query object</param> /// <param name="pubTypes">PublicationTypes object</param> /// <param name="person">Person to retrieve publications for</param> /// <param name="StatusCallback">Callback function to return status</param> /// <param name="MessageCallback">Callback function to send messages</param> /// <param name="AverageMilliseconds">Average time (in milliseconds) of each publication write</param> /// <returns>Number of publications written</returns> public int GetPublications(NCBI ncbi, PublicationTypes pubTypes, Person person, GetPublicationsStatus StatusCallback, GetPublicationsMessage MessageCallback, CheckForInterrupt InterruptCallback, out double AverageMilliseconds) { ArrayList Parameters; DateTime StartTime; DateTime EndTime; double TotalMilliseconds = 0; AverageMilliseconds = 0; int numberFound = 0; int numberWritten = 0; // Double-check that the person is really unharvested. If we try to // write publications for a person who already has publications, it will // cause an error -- and that could happen if this person was already // written from a duplicate person earlier. Parameters = new ArrayList(); Parameters.Add(Database.Parameter(person.Setnb)); int HarvestedCount = DB.GetIntValue("SELECT Count(*) FROM People WHERE Setnb = ? AND Harvested = 1", Parameters); if (HarvestedCount > 0) { MessageCallback("Already harvested publications for " + person.Last + " (" + person.Setnb + ")", false); Parameters = new ArrayList(); Parameters.Add(Database.Parameter(person.Setnb)); return(DB.GetIntValue("SELECT Count(*) FROM PeoplePublications WHERE Setnb = ?", Parameters)); } MessageCallback("Retrieving data from NCBI", true); // Find any other people with the same names and search criteria. // Any publications found for this person should also be found // for them, so when we write the rows to PeoplePublications later // we'll also write them for the other people as well. // Look in the database for any other people with the same // values for name1, name2, name3, name4, name5, name6, and MedlineSearch. // Write their PeoplePublications as well. string NamesClause = ""; Parameters = new ArrayList(); for (int i = 0; i < 6; i++) { if (i < person.Names.Length) { Parameters.Add(Database.Parameter(person.Names[i])); NamesClause += " Name" + ((int)(i + 1)).ToString() + " = ? AND "; } else { NamesClause += " Name" + ((int)(i + 1)).ToString() + " IS NULL AND "; } } Parameters.Add(Database.Parameter(person.MedlineSearch)); Parameters.Add(Database.Parameter(person.Setnb)); DataTable Results = DB.ExecuteQuery("SELECT " + Database.PEOPLE_COLUMNS + @"FROM People WHERE Harvested = 0 AND " + NamesClause + @" MedlineSearch = ? AND Setnb <> ?", Parameters ); ArrayList DuplicatePeople = new ArrayList(); foreach (DataRow Row in Results.Rows) { Person dupe = new Person(Row, Results.Columns); DuplicatePeople.Add(dupe); MessageCallback("Also writing publications for " + dupe.Last + " (" + dupe.Setnb + ") with same names and search criteria", false); } // Search NCBI -- if an error is thrown, write that error to the database string results; try { results = ncbi.Search(person.MedlineSearch); if (results.Substring(0, 100).Contains("Error occurred")) { // NCBI returns an HTML error page in the results // // <html> // <body> // <br/><h2>Error occurred: Unable to obtain query #1</h2><br/> // ... // // If NCBI returns an empty result set with no publications, it will give the error: // Error occurred: Empty result - nothing todo // // That error should generate a warning and mark the person as harvested in the database. // Any other error should be written to the database as an error. string Error = results.Substring(results.IndexOf("Error occurred")); if (results.Contains("<")) { Error = Error.Substring(0, Error.IndexOf("<")); } string Message; if (Error.ToLower().Contains("empty result")) { Message = "Warning for " + person.Last + " (" + person.Setnb + "): no publications found (NCBI returned empty results)"; person.Harvested = true; person.WriteToDB(DB); } else { Message = "Error reading publications for " + person.Last + " (" + person.Setnb + "): NCBI returned '" + Error + "'"; person.WriteErrorToDB(DB, Message); } MessageCallback(Message, false); return(0); } } catch (Exception ex) { string Message = "Error reading publications for " + person.Last + " (" + person.Setnb + "): " + ex.Message; person.WriteErrorToDB(DB, Message); MessageCallback(Message, false); return(0); } Publications mpr = new Publications(results, pubTypes); if (mpr.PublicationList != null) { foreach (Publication publication in mpr.PublicationList) { numberFound++; // Exit immediately if the user interrupted the harvest if (InterruptCallback()) { return(numberWritten); } try { // Calculate the average time, to return in the callback status function StartTime = DateTime.Now; // Add the publication to PeoplePublications // First find the author position and calculate the position type int AuthorPosition = 0; for (int i = 1; (publication.Authors != null) && (AuthorPosition == 0) && (i <= publication.Authors.Length); i++) { foreach (string name in person.Names) { if (StringComparer.CurrentCultureIgnoreCase.Equals( publication.Authors[i - 1], name //.ToUpper() )) { AuthorPosition = i; } else if (name == "*") { AuthorPosition = -1; } } } // If the PMID is 0, we don't have a way to process the publication // and it was probably a Medline search result error. if (publication.PMID == int.MinValue) { string errorMessage = "Found an invalid publication"; if (!string.IsNullOrEmpty(publication.Title)) { errorMessage += " (Title = '" + publication.Title + "')"; } person.WriteErrorToDB(DB, errorMessage); MessageCallback(errorMessage, false); } else if (publication.PMID == 0) { string errorMessage = "WARNING: Found a publication with PMID = 0, not marking this as an error"; if (!string.IsNullOrEmpty(publication.Title)) { errorMessage += " (Title = '" + publication.Title + "')"; } MessageCallback(errorMessage, false); } // If for some reason the author doesn't exist in the publication, send a message back else if (AuthorPosition == 0) { MessageCallback("Publication " + publication.PMID + " does not contain author " + person.Setnb, false); } else { // Write the publication to the database if (Publications.WriteToDB(publication, DB, pubTypes, Languages)) { // Exit immediately if the user interrupted the harvest if (InterruptCallback()) { return(numberWritten); } // Only increment the publication count if the publication // is actually written or already in the database numberWritten++; // Only add the row to PeoplePublications if the publication // was written, or was already in the database. (For example, // if the publication is not in English, it won't be written.) Publications.WritePeoplePublicationsToDB(DB, person, publication); // Write the publication for each of the other people foreach (Person dupe in DuplicatePeople) { Publications.WritePeoplePublicationsToDB(DB, dupe, publication); } // Calculate the average time per publication in milliseconds EndTime = DateTime.Now; TimeSpan Difference = EndTime - StartTime; TotalMilliseconds += Difference.TotalMilliseconds; AverageMilliseconds = TotalMilliseconds / numberWritten; } } } catch (Exception ex) { person.WriteErrorToDB(DB, ex.Message); MessageCallback("Error writing publication " + publication.PMID.ToString() + ": " + ex.Message, false); } StatusCallback(numberFound, mpr.PublicationList.Length, (int)AverageMilliseconds); } } // Make sure each of the people with the same names and search query // are marked as harvested and have their errors cleared foreach (Person dupe in DuplicatePeople) { Parameters = new ArrayList(); Parameters.Add(Database.Parameter(dupe.Setnb)); DB.ExecuteNonQuery( @"UPDATE People SET Harvested = 1, Error = NULL, ErrorMessage = NULL WHERE Setnb = ?", Parameters); } // Once the publications are all read, updated People.Harvested, as part of // the fault-tolerance scheme -- PeoplePublications rows are only "final" when // this value is updated for the person. Any others can be cleared using // ClearDataAfterInterruption(). Parameters = new ArrayList(); Parameters.Add(Database.Parameter(person.Setnb)); DB.ExecuteNonQuery(@"UPDATE People SET Harvested = 1 WHERE Setnb = ?", Parameters); return(numberWritten); }
public override IParser CreateParser(ILexer lexer, ISolution solution, IProject project, CheckForInterrupt checkForInterrupt) { return new L4NParser(lexer, checkForInterrupt); }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (psiFile == null) { throw new ArgumentNullException("psiFile"); } psiFile.ProcessDescendants(new MyFileExplorer(this, consumer, psiFile, interrupted)); }
public MappingFileTreeBuilder(XmlElementFactory elementFactory, CheckForInterrupt checkForInterrupt) : base(elementFactory, checkForInterrupt, MappingFileLanguageService.MAPPING_FILE) { }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { _storEvilFileExplorer.ExploreFile(psiFile, consumer, interrupted); }
/// <summary> /// Explores given PSI file. /// </summary> public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (psiFile == null) throw new ArgumentNullException("psiFile"); if (consumer == null) throw new ArgumentNullException("consumer"); #if ! RESHARPER_31 && ! RESHARPER_40 && ! RESHARPER_41 using (ReadLockCookie.Create()) #endif { if (!psiFile.IsValid()) return; try { PsiReflectionPolicy reflectionPolicy = new PsiReflectionPolicy(psiFile.GetManager()); ConsumerAdapter consumerAdapter = new ConsumerAdapter(provider, consumer, psiFile); var codeElements = new List<ICodeElementInfo>(); psiFile.ProcessDescendants(new OneActionProcessorWithoutVisit(delegate(IElement element) { ITypeDeclaration declaration = element as ITypeDeclaration; if (declaration != null) PopulateCodeElementsFromTypeDeclaration(codeElements, reflectionPolicy, declaration); }, delegate(IElement element) { if (interrupted()) throw new ProcessCancelledException(); // Stop recursing at the first type declaration found. return element is ITypeDeclaration; })); Describe(reflectionPolicy, codeElements, consumerAdapter); ProjectFileState.SetFileState(psiFile.GetProjectFile(), consumerAdapter.CreateProjectFileState()); } catch (Exception ex) { HandleEmbeddedProcessCancelledException(ex); throw; } } }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (!xUnitInstalled) { return; } if (provider == null) { return; } if (psiFile == null) { throw new ArgumentNullException("psiFile"); } var project = psiFile.GetProject(); if (project == null) { return; } if (project.GetAssemblyReferences().Any(IsSilverlightMscorlib)) { return; } var psiFileExplorer = (IRecursiveElementProcessor)Activator.CreateInstance(XunitPsiFileExplorerType, provider, consumer, psiFile, interrupted); psiFile.ProcessDescendants(psiFileExplorer); }
// ReSharper 8.1 replaced CheckForInterrupt with Func<bool> public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { ExploreFile(psiFile, consumer, new Func<bool>(() => interrupted())); }
public NHTreeBuilder(XmlElementFactory elementFactory, CheckForInterrupt checkForInterrupt) : base(elementFactory, checkForInterrupt, NHLanguageService.NH) { }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { }
public MyFileExplorer(IUnitTestProvider provider, UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted) { if (file == null) { throw new ArgumentNullException("file"); } if (provider == null) { throw new ArgumentNullException("provider"); } myConsumer = consumer; myProvider = provider; myFile = file; myInterrupted = interrupted; myProject = myFile.ProjectFile.GetProject(); myAssemblyPath = UnitTestManager.GetOutputAssemblyPath(myProject).FullPath; }
public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (interrupted()) { return; } // don't bother going any further if there's isn't a project with a reference to the Fixie assembly var project = psiFile.GetProject(); if (project == null) { return; } if (project.GetModuleReferences().All(module => module.Name != "Fixie")) { return; } psiFile.ProcessDescendants(new PsiFileExplorer(unitTestElementFactory, conventionCheck, consumer, psiFile, interrupted)); }