Ejemplo n.º 1
0
        public void ProcessCache(IChangesetProcessor changesetProcessor)
        {
            if (string.IsNullOrEmpty(cacheOutput))
            {
                return;
            }

            var files = fileSystem.GetFiles(fileSystem.GetParentFullName(cacheOutput), "*.json");

            foreach (var file in files)
            {
                logger.LogToConsole($"Processing {file.FileName}");
                var workItemList = workItemParser.ParseFile(file.FileName);
                foreach (var workItem in workItemList)
                {
                    if (workItem.ChangesetId == null)
                    {
                        continue;
                    }
                    if (!changesetProcessor.WorkItemCache.ContainsKey(workItem.ChangesetId))
                    {
                        changesetProcessor.WorkItemCache.Add(workItem.ChangesetId, new List <WorkItem>());
                    }

                    changesetProcessor.WorkItemCache[workItem.ChangesetId].Add(workItem);
                }
            }
        }
Ejemplo n.º 2
0
        private GitCodeChurnProcessor(ICommandLineParser commandLineParser, IProcessWrapper processWrapper, IGitLogParser gitLogParser, IOutputProcessor outputProcessor, IBugDatabaseProcessor bugDatabaseProcessor, ILogger logger, string outputFile, OutputType outputType, string bugRegexes, string bugDatabaseDLL, string bugDatabaseOutputFile, IEnumerable <string> bugDatabaseDllArgs, string gitLogCommand)
        {
            this.commandLineParser    = commandLineParser;
            this.processWrapper       = processWrapper;
            this.gitLogParser         = gitLogParser;
            this.outputProcessor      = outputProcessor;
            this.bugDatabaseProcessor = bugDatabaseProcessor;
            this.logger                = logger;
            this.outputType            = outputType;
            this.outputFile            = outputFile;
            this.bugDatabaseDLL        = bugDatabaseDLL;
            this.bugDatabaseOutputFile = bugDatabaseOutputFile;
            this.bugDatabaseDllArgs    = bugDatabaseDllArgs;
            this.gitLogCommand         = gitLogCommand;
            this.bugRegexes            = bugRegexes;

            this.changesetProcessor = new ChangesetProcessor(bugRegexes, this.logger);
        }
        private PerforceCodeChurnProcessor(IProcessWrapper processWrapper, IChangesParser changesParser, IDescribeParser describeParser, ICommandLineParser commandLineParser, IBugDatabaseProcessor bugDatabaseProcessor, ILogger logger, IStopWatch stopWatch, IOutputProcessor outputProcessor, string outputFile, OutputType outputType, string bugDatabaseDLL, string bugDatabaseOutputFile, IEnumerable <string> bugDatabaseDllArgs, string p4ChangesCommandLine, string p4DescribeCommandLine, string bugRegexes)
        {
            this.processWrapper       = processWrapper;
            this.changesParser        = changesParser;
            this.describeParser       = describeParser;
            this.commandLineParser    = commandLineParser;
            this.bugDatabaseProcessor = bugDatabaseProcessor;
            this.logger                = logger;
            this.stopWatch             = stopWatch;
            this.outputProcessor       = outputProcessor;
            this.outputFile            = outputFile;
            this.outputType            = outputType;
            this.bugDatabaseDLL        = bugDatabaseDLL;
            this.bugDatabaseOutputFile = bugDatabaseOutputFile;
            this.bugDatabaseDllArgs    = bugDatabaseDllArgs;
            this.p4ChangesCommandLine  = p4ChangesCommandLine;
            this.p4DescribeCommandLine = p4DescribeCommandLine;

            this.changesetProcessor = new ChangesetProcessor(bugRegexes, this.logger);
        }
        public void ProcessCache(IChangesetProcessor changesetProcessor)
        {
            var workItemDocuments = dataDocumentRepository.GetAllDocumentsByProjectAndDocumentType <WorkItem>(projectName, DocumentType.BugDatabase);

            logger.LogToConsole($"Processing {workItemDocuments.Count} work items of {projectName} project");

            foreach (var workDocument in workItemDocuments)
            {
                foreach (var workItemList in workDocument.Data)
                {
                    if (workItemList.ChangesetId == null)
                    {
                        continue;
                    }
                    if (!changesetProcessor.WorkItemCache.ContainsKey(workItemList.ChangesetId))
                    {
                        changesetProcessor.WorkItemCache.Add(workItemList.ChangesetId, new List <WorkItem>());
                    }

                    changesetProcessor.WorkItemCache[workItemList.ChangesetId].Add(workItemList);
                }
            }
        }
        public void SetUp()
        {
            repository = new MockRepository();

            profileMock = repository.StrictMock<IProfile>();
            eventManagerMock = repository.StrictMock<IEventManager>();
            connectorMock = repository.StrictMock<ICvsConnector>();
            logParserMock = repository.StrictMock<ICvsLogParser>();
            processorMock = repository.StrictMock<IChangesetProcessor>();
            storageMock = repository.Stub<IChangesetStorage>();
            containerMock = repository.StrictMock<IKernel>();

            CvsComponentFactory.Instance.RegisterOverride(connectorMock);
            CvsComponentFactory.Instance.RegisterOverride(logParserMock);
            CvsComponentFactory.Instance.RegisterOverride(processorMock);
            CvsComponentFactory.Instance.RegisterOverride(storageMock);
        }