Search in sources :

Example 1 with CommonRuleEngineImpl

use of org.sonar.ce.task.projectanalysis.issue.commonrule.CommonRuleEngineImpl in project sonarqube by SonarSource.

the class IntegrateIssuesVisitorTest method setUp.

@Before
public void setUp() throws Exception {
    IssueVisitors issueVisitors = new IssueVisitors(new IssueVisitor[] { issueVisitor });
    defaultIssueCaptor = ArgumentCaptor.forClass(DefaultIssue.class);
    when(movedFilesRepository.getOriginalFile(any(Component.class))).thenReturn(Optional.empty());
    DbClient dbClient = dbTester.getDbClient();
    TrackerRawInputFactory rawInputFactory = new TrackerRawInputFactory(treeRootHolder, reportReader, sourceLinesHash, new CommonRuleEngineImpl(), issueFilter, ruleRepositoryRule, activeRulesHolder);
    TrackerBaseInputFactory baseInputFactory = new TrackerBaseInputFactory(issuesLoader, dbClient, movedFilesRepository, mock(ReportModulesPath.class), analysisMetadataHolder, new IssueFieldsSetter(), mock(ComponentsWithUnprocessedIssues.class));
    TrackerTargetBranchInputFactory targetInputFactory = new TrackerTargetBranchInputFactory(issuesLoader, targetBranchComponentUuids, dbClient);
    TrackerReferenceBranchInputFactory mergeInputFactory = new TrackerReferenceBranchInputFactory(issuesLoader, mergeBranchComponentsUuids, dbClient);
    ClosedIssuesInputFactory closedIssuesInputFactory = new ClosedIssuesInputFactory(issuesLoader, dbClient, movedFilesRepository);
    tracker = new TrackerExecution(baseInputFactory, closedIssuesInputFactory, new Tracker<>(), issuesLoader, analysisMetadataHolder);
    mergeBranchTracker = new ReferenceBranchTrackerExecution(mergeInputFactory, new Tracker<>());
    prBranchTracker = new PullRequestTrackerExecution(baseInputFactory, targetInputFactory, new Tracker<>(), newLinesRepository);
    trackingDelegator = new IssueTrackingDelegator(prBranchTracker, mergeBranchTracker, tracker, analysisMetadataHolder);
    treeRootHolder.setRoot(PROJECT);
    protoIssueCache = new ProtoIssueCache(temp.newFile(), System2.INSTANCE);
    when(issueFilter.accept(any(DefaultIssue.class), eq(FILE))).thenReturn(true);
    when(issueChangeContext.date()).thenReturn(new Date());
    underTest = new IntegrateIssuesVisitor(protoIssueCache, rawInputFactory, issueLifecycle, issueVisitors, trackingDelegator, issueStatusCopier, referenceBranchComponentUuids, mock(PullRequestSourceBranchMerger.class));
}
Also used : Tracker(org.sonar.core.issue.tracking.Tracker) DbClient(org.sonar.db.DbClient) CommonRuleEngineImpl(org.sonar.ce.task.projectanalysis.issue.commonrule.CommonRuleEngineImpl) IssueFieldsSetter(org.sonar.server.issue.IssueFieldsSetter) ReportModulesPath(org.sonar.ce.task.projectanalysis.component.ReportModulesPath) DefaultIssue(org.sonar.core.issue.DefaultIssue) Date(java.util.Date) Component(org.sonar.ce.task.projectanalysis.component.Component) ReportComponent(org.sonar.ce.task.projectanalysis.component.ReportComponent) Before(org.junit.Before)

Aggregations

Date (java.util.Date)1 Before (org.junit.Before)1 Component (org.sonar.ce.task.projectanalysis.component.Component)1 ReportComponent (org.sonar.ce.task.projectanalysis.component.ReportComponent)1 ReportModulesPath (org.sonar.ce.task.projectanalysis.component.ReportModulesPath)1 CommonRuleEngineImpl (org.sonar.ce.task.projectanalysis.issue.commonrule.CommonRuleEngineImpl)1 DefaultIssue (org.sonar.core.issue.DefaultIssue)1 Tracker (org.sonar.core.issue.tracking.Tracker)1 DbClient (org.sonar.db.DbClient)1 IssueFieldsSetter (org.sonar.server.issue.IssueFieldsSetter)1